in reply to Re: Iterating over verbatim hash reference
in thread Iterating over verbatim hash reference

This doesn't answer my question, because you are introducing a variable for the hash ref here, i.e. $h. Of course this works, as you see from the 2nd example in my original posting. The point is to do it without naming the hash/hashref.

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^3: Iterating over verbatim hash reference
by AnomalousMonk (Archbishop) on Jan 21, 2010 at 18:53 UTC
    ... 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
Re^3: Iterating over verbatim hash reference
by Anonymous Monk on Jan 21, 2010 at 14:31 UTC
    It isn't possible, you need a name.