I have tried iterating with foreach and the hash itself
foreach (keys $hash){
print $_ . "\n";
}
So far so good ...
Given the code you OPed, it's hard to imagine this would have done anything "good" unless $hash.was actually a hash reference. If this was the case, please be aware of this from the latest Perl documentation:
Starting with Perl 5.14, an experimental feature allowed keys to take a scalar expression. This experiment has been deemed unsuccessful, and was removed as of Perl 5.24.This experimental ex-feature was also associated with values, each, push, pop and friends.
Give a man a fish: <%-{-{-{-<
In reply to Re^3: Using foreach to iterate through a hash in an array
by AnomalousMonk
in thread Using foreach to iterate through a hash in an array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |