in reply to lopping through a hash passed as a reference
Very close. Try this instead:
The code you have above is for a hash named %hash, not a reference to a hash contained in a scalar $hash. Notice that in the code above, the sigil preceding the variable is always a $.foreack $k (keys %$hash) { print "$k => $hash->{$k}\n"; print "$k => $$hash{$k}\n"; # equivalent }
For more info on references in general, take a look at perlref and perlreftut.
|
|---|