in reply to interleave two arrays
Ack, what have I done, this will surely lead to endless perl golf!sub interleave { my $y; while (@{ $_[0] } or @{ $_[1] }) { push @$y, shift @{ $_[0] } if @{ $_[0] }; push @$y, shift @{ $_[1] } if @{ $_[1] }; } return $y; }
Ciao,
Gryn
Update: Eek, this doesn't work. Please ignore -- I'm at work and will be a while to fix.
Update: Ok that seems better. Thank you for your patience :)
|
|---|