in reply to Pushing a 'hash slice' to an AoH

A "hash slice" is a list of values from the hash. It is not a hash itself. That means you have to use something a bit more than hash slicing to build the new hash you want to push on your array. It can be done in one statement...
push @events, { map { $_ => $sqldata->[$i]{$_} } qw( col1 col2 col3 ) };
...but why?

Replies are listed 'Best First'.
Re^2: Pushing a 'hash slice' to an AoH
by bradcathey (Prior) on Jun 11, 2004 at 16:46 UTC
    Thank you Anonymous Monk (that monk gets around). Before the OP, I had tried using map, but was unable to get it to work successfully. Yours worked like a charm.

    —Brad
    "A little yeast leavens the whole dough."