In your first version $hashRef{$key}, you make use of %hashRef which is not declared. Change it to $hashRef->{$key} and you should be fine. No need to do a copy as in your workaround which would be wasteful if the hash is large.
In reply to Re: Hash dereferencing in a loop
by hdb
in thread Hash dereferencing in a loop
by willjones
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |