in reply to Re^2: how can i return the common keys from a hash
in thread how can i return the common keys from a hash
It checks for defined as the loop condition, not a true value.perl -MO=Deparse -wle 'my %a = ( 0 => 1, y => 2, z => 4); while (my $m + = each %a) { print $m }' BEGIN { $^W = 1; } BEGIN { $/ = "\n"; $\ = "\n"; } my(%a) = (0, 1, 'y', 2, 'z', 4); while (defined(my $m = each %a)) { print $m; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: how can i return the common keys from a hash
by ivancho (Hermit) on Aug 05, 2006 at 02:07 UTC |