in reply to interleave two arrays
#the following gives: a 1 b 2 c 3 @arr1 = qw(a b c); @arr2 = qw(1 2 3); while (@arr1) {push @arr3, shift @arr1,shift @arr2} print "@arr3"; #BUT why does the following give an infinite loop? @arr1 = qw(a b c); @arr2 = qw(1 2 3); while ($push @arr3, shift @arr1,shift @arr2){}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: interleave two arrays
by choroba (Cardinal) on Feb 02, 2014 at 23:11 UTC | |
by kloro2006 (Initiate) on Feb 02, 2014 at 23:19 UTC |