@array1 = (1,2,3);
$length = @array1[1,2]; # assigning a slice to $length
print "length = $length"; # prints 3 (ie length of array not length of slice)
@slice = @array1[1,2];
print "\n";
$length = @slice; # assigning slice-converted-into-array to $length
print "length = $length"; # prints 2
----------------------------------------
Why the difference ?
Advice welcomed.
Thanks - Griff
$length = @array1[1,2]; # assigning a slice to $length
print "length = $length"; # prints 3 (ie length of array not length of slice)
@slice = @array1[1,2];
print "\n";
$length = @slice; # assigning slice-converted-into-array to $length
print "length = $length"; # prints 2
----------------------------------------
Why the difference ?
Advice welcomed.
Thanks - Griff
Comment