in reply to interleave two arrays
Shockingly (for me to see this question here), I just solved this problem two days ago.
Try this:
@foo = ( 1 , 3 , 5 , 7 ); @bar = ( 2 , 4 , 6 , 8 ); @baz = map { ( $_ , shift @bar ) } @foo;
It suffers from losing the end of @bar if length( @bar ) > length ( @foo ) though.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: interleave two arrays
by La12 (Sexton) on Jul 02, 2001 at 19:58 UTC | |
by scott (Chaplain) on Jul 03, 2001 at 17:14 UTC |