
amuses
New User
Apr 13, 2007, 8:39 AM
Post #1 of 2
(638 views)
|
interpreting subarray in list context
|
Can't Post
|
|
@a1 = ( 4 , 5, 6); ($x, $y, $z) = @a1[0..2]; print "$x, $y, $z\n"; #outputs 4 5 6 as expected @a2 = (); $a2[0] = [4, 5, 6]; # a sub-array ($x, $y, $z) = $a2[0][0..2]; # DOESNT WORK THE SAME So what's the correct analogous syntax to do this? And by analogous I mean, not this: ($x, $y, $z) = ($a2[0][0] , $a2[0][1], $a2[0][2]); which works, but is not analogous. This mystery has been illuding me for years.
|