in reply to Re: Unexpected persistence with each hash
in thread Unexpected persistence with each hash
Thanks, stricture would have indeed caught the typo. As you suggest, my $key = each %foo; was what I meant. The corrected code,
works as intended.my %foo; @foo{qw/foo bar baz/} = 1 .. 3; while (%foo) { my $key = each %foo; my $val = delete $foo($key}; printf "%s => %s is gone.\n", $key, $val; }
In scalar context, each returns only a key.
/me claims the brown bag for today. What you refuse to see, is your worst trap in action. Thanks also to ++Albannach.
After Compline,
Zaxo
|
|---|