On Mon, Jul 26, 2010 at 08:09, Sharan Basappa <sharan.basa...@gmail.com> wrote: > Folks, > > I am reusing a code for some enhancements. According to my > understanding, it is a record with > some unique string as key and then hash array as the value. > > I iterate through the array and print as follows: > > foreach my $key (keys %{$abc}) > { > print "$key ${$abc}{$key} \n"; > } > > I get values such like: > val_0001 HASH(0x186c0060) > val_0002 HASH(0x187ea490) > val_0003 HASH(0x18655bc0) > val_0004 HASH(0x1880fc60) > > Can someone tell me how to get the actual value instead of HASH* as above? snip
You are getting HASH(hex number) because the values in the hashref referred to by $abc are themselves hashrefs. Depending on how the data is structured, you may be able to say: for my $outer (keys %$abc) for my $inner (keys %{$abc->{$outer}}) print "$outer $inner $abc->{$outer}{$inner}\n"; } } To find out how the data is structured, try this instead: use Data::Dumper; print Dumper $abc; That will print out the Perl code needed to recreate the structure. You may also find [perldoc perldsc][0] useful. [0]: http://perldoc.perl.org/perldsc.html -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/