Perl: Array Slices
Array Slices
A slice is a subset of an array
Also accessed by subscript - [ ]
Useful for swapping items, or when you want part of your array, but more than a single item
@flintstones = ("fred","wilma","barney","betty");
@flintstones[0,2]; # a slice equal to ("fred","barney");
@flintstones[0..2]; # ("fred", "wilma", "barney");
@flintstones[0,2] = @flintstones[2,0]; #swap fred & barney