in reply to Re^2: Iterating over verbatim hash reference
in thread Iterating over verbatim hash reference
... without introducing a new variable ...
The following variation doesn't introduce a new variable because $_ already exists! (I believe the following is also Stupid Hash Trick #58.)
>perl -wMstrict -le "for ({ qw(a 1 b 2 c 3) }) { while (my ($k, $v) = each %$_) { print qq{$k => $v}; } } " c => 3 a => 1 b => 2
|
---|