If I have a Perl hash with a bunch of (key, value) pairs, what is the preferred method of iterating through all the keys? I have heard that using each may in s
each
I usually use keys and I can't think of the last time I used or read a use of each.
keys
Don't forget about map, depending on what you're doing in the loop!
map
map { print "$_ => $hash{$_}\n" } keys %hash;