CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
How to acess Hash data

 



milan.dalwadi
New User

Mar 28, 2014, 6:23 AM

Post #1 of 3 (10828 views)
How to acess Hash data Can't Post

Hello all here i want to take information from one timing report from there information of different pathgroup in itself that one pathgroup it divided in other four paths and in individual four path there is a some slack value is present..all that i done extract that information and store to hash.. now the problem is i cannot acess value of that hash only pathgroup name is there but there is couter is incremented for diffrent four paths and also for its slack..here small cade pls help me out how can i access my data of it..?? at the end i also attach the one path of my report file from where i extract all the data..

Code
if (/Path Group:\s+(\S+)/) { 
$temp = $1;
$temp =~ s/(\*)+//g ;
$count_{$temp}++;
$PG{"$temp"}{$start_end_brckt}
+ = "$start_brckt$end_brckt";
}
if (/slack\s+\(VIOLATED\)/) {
chomp $_ ;
$_ =~ s/slack\s\(VIOLATED\) \s+//g ;
$_ =~ s/\s+//g;
# $start = 0;
$PG{"$temp"}{"$start_end_brckt"}{$slack} = $_ ;

print "\nPathGroup :: $temp\n";
print "Pathname :: $PG{$temp}{$start_end_br
+ckt}\n";
print "slack : :$PG{$temp}{$start_end_brckt}{$slack}\n\n";
+
$start = 0;
$end = 0;
$start_brckt = 0;
$end_brckt = 0; $slack ++; $start_end_brckt ++
+;
}
}
foreach my $pathgroup1 ( keys %PG) {
foreach my $path1 ( keys %{$PG{$pathgroup1}}) { #print"hell
+o";
foreach my $path2 ( keys %{$PG{$pathgroup1}{$path1}}) {
print "\t$pathgroup1 :: $path1 :: $path2 \t\n";

}
} }

----------------------------------------------------------------report
+ file------------------------------------
Startpoint: abc
(input )
Endpoint: xyz
(rising )
Path Group: hello
Path Type: max

Point Incr P
+ath
--------------------------------------------------------------------
+------
data required time 1
+.26
data arrival time -3
+.24
--------------------------------------------------------------------
+------
slack (VIOLATED) -1



FishMonger
Veteran / Moderator

Mar 28, 2014, 7:57 AM

Post #2 of 3 (10813 views)
Re: [milan.dalwadi] How to acess Hash data [In reply to] Can't Post

Due to your poor and inconsistent code formatting (referring to the indentation), your code is difficult to read.

Use the Data::Dumper module to dump out the hash to get a better view of its structure. From there you should be able to see how to access the data.


(This post was edited by FishMonger on Mar 28, 2014, 8:01 AM)


FishMonger
Veteran / Moderator

Mar 28, 2014, 8:01 AM

Post #3 of 3 (10812 views)
Re: [milan.dalwadi] How to acess Hash data [In reply to] Can't Post

When cross posting questions, it's considered poor forum etiquette to not divulge that info.

http://www.perlmonks.org/?node_id=1080084

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives