use Data::Dumper; sub zip { my @list1 = @{shift()}; my @list2 = @{shift()}; my @zip; while (@list1+@list2) { push(@zip, shift(@list1), shift(@list2)); } @zip } my @z1 = zip([qw(a b c)], [qw(5 6 7 8 9)]); print Dumper(\@z1); my @z2 = zip([qw(5 6 7 8 9)], [qw(d e f)]); print Dumper(\@z2);
In reply to Re: Making a hash with lists
by pc88mxer
in thread Making a hash with lists
by knarf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |