A program that uses an array variable as an array-slice subscript.
#!/usr/local/bin/perl
@array = ("one", "two", "three", "four", "five");
@range = (1, 2, 3);
@subarray = @array[@range];
print ("The array slice is: @subarray\n");
Related examples in the same category