![]() |
|
Welcome to the Monastery | |
PerlMonks |
Re: Iterating over an hash while removing keysby choroba (Cardinal) |
on Feb 06, 2020 at 16:55 UTC ( #11112500=note: print w/replies, xml ) | Need Help?? |
You don't have to call scalar. Using a void context resets the iterator without even checking the keys at all.
Update: Documented in keys: > In particular, calling "keys" in void context resets the iterator with no other overhead.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
In Section
Seekers of Perl Wisdom
|
|