There's more than one way to do things | |
PerlMonks |
Re: preserving hash value outside the loopby hippo (Bishop) |
on May 11, 2016 at 09:48 UTC ( [id://1162727]=note: print w/replies, xml ) | Need Help?? |
Yes, it is possible. Simply declare $key outside the while loop instead of inside it. See Coping with Scoping. Of course you'll only see the value from the last time $key is set but it's not immediately clear from your post if that's a problem for you.
In Section
Seekers of Perl Wisdom
|
|