in reply to Re: Ouch! Each! Reentrant it is not
in thread Ouch! Each! Reentrant it is not

You can avoid the scalar op and a useless variable by just calling keys in scalar context:

I'd want to see that documented in the code or someone will get bitten!

keys %hash; # reset each to beginning of hash return "The key for 2 is $key\n" if $val == 2;

--
Murray Barton
Do not seek to follow in the footsteps of the wise. Seek what they sought. -Basho