http://www.perlmonks.org?node_id=355450


in reply to Merging an array into an AoH

If you don't mind throwing away @results, you could do

$_->{id} = shift @results for @box;

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail

Replies are listed 'Best First'.
Re: Re: Merging an array into an AoH
by rjray (Chaplain) on May 22, 2004 at 00:36 UTC

    Except that should be:

    $_->{value} = shift @results for @box;

    He's assigning the data from @results to the value key. id is already in use.

    (Still, the best solution of the lot :-).

    --rjray