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

New User

Mar 28, 2014, 6:23 AM

Views: 16519
How to acess Hash data

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..

if (/Path Group:\s+(\S+)/) { 
$temp = $1;
$temp =~ s/(\*)+//g ;
+ = "$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
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
foreach my $path2 ( keys %{$PG{$pathgroup1}{$path1}}) {
print "\t$pathgroup1 :: $path1 :: $path2 \t\n";

} }

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

Point Incr P
data required time 1
data arrival time -3
slack (VIOLATED) -1

Veteran / Moderator

Mar 28, 2014, 7:57 AM

Views: 16504
Re: [milan.dalwadi] How to acess Hash data

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)

Veteran / Moderator

Mar 28, 2014, 8:01 AM

Views: 16503
Re: [milan.dalwadi] How to acess Hash data

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