in reply to How to push the first two elements of an array in another array
c:\@Work\Perl>perl -wMstrict -MData::Dump -le "my @array1 = (1,2,3,4,5); my @array2 = @array1[ 0, 1 ]; dd \@array2; " [1, 2]
Update:
... I want the first two elements (1 and 2) ...BTW: Perl arrays are (by default) 0-based, so the first two elements are at indices 0 and 1.
|
|---|