Ew. Copying both arrays to avoid destroying them is horribly inefficient. As is building an array only to return it as a list:
sub zip { my( $r1, $r2 ) = @_; map { $r1->[ $_ ], $r2->[ $_ ] } 0 .. ( @$r1 > @$r2 ? @$r1 : @$r2 ); }
Updated length determination.
In reply to Re^2: Making a hash with lists
by BrowserUk
in thread Making a hash with lists
by knarf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |