in reply to Can't access hash of hashes.
Start by printing the base:
if you get a HASH(gibberish), you'll know it's a hash reference. Then you can print the elements of that:print $prochash;
In your case, the base is a hash, so:foreach my $key (keys %{$prochash}){ print $key,'--',$prochash->{$key},"\n"; }
Which should show a bunch of HASH references.foreach my $key( keys %prochash){ print $key, '--', $prochash{$key},"\n"; }
Often, while debugging these, I will find that I accidentally slipped in a reference to a reference while passing values betweeen subs. So if $hashref is a reference to a hash, I passed \$hashref, which creates a reference to a scalar (that scalar being a reference to a hash. When this happens, my
gives me SCALAR(0XFFFFF), and I've determined where the problem is introduced.print $hashref;
I'm sure others will recommend the perl debugger or even not making the mistake in the first place as a solution, but this is the technique I found most useful when learning references, and I still use it now and then when my $value->{key}->{key}->[3]->{key} doesn't work. :)
|
|---|