[Chicago-talk] Array slices

Jay Strauss me at heyjay.com
Sun Nov 5 04:47:29 PST 2006


Is there any way other than iteration to get an array slice of a
multi-dimensional array?

For example, I'd like to create a slice out of the 2nd element of each
inner array, so that my result would be (2,4,6).

@a = ([1,2],[3,4],[5,6]);

print join @a[][1],"\n";  # doesn't work
print join @a[0..2][1],"\n"; #doesn't work

Obviously I can use any type of loop structure to build the desired
array, I just thought there would be shorthand syntax.


More information about the Chicago-talk mailing list