my %h = (); $h{$_->[0]} = [$->[1]] for @a1; # this will make empty arrayrefs automatically where necessary $h{$_->[0]}[1] = $_->[1] for @a2; my @b = map {[ $_ => @{$h{$_}} ]} sort keys %h;
(sort is probably ok to preserve the order here, but if it weren't, then Tie::IxHash might be helpful instead.)
-Paul
In reply to Re: mashing two arrays
by jettero
in thread mashing two arrays
by punkish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |