#!perl -w use strict; =head1 NOTES This example illustrates how one can use slicing in an array to get at data. The slice arrays @number and @debt will pick up only those entries in the @entry array. Any array is numbered from zero to one less than the number in the array. So these 5 items in this @entry array can be accessed as a group by having a slice array. The @number slice array picks up the index of 2, 3, and 4 and returns it as another array using the following Perl code: @entry[@number] To print it cleanly, I join a physical tab in between each returned array item in the print statement. join( "\t", @entry[@number] ) see perldoc -f join In this program I chose names from the founding fathers of America and a slice array called @debt for the debt of gratitude we owe them for helping to found a country based on liberty and freedom. Note the change when I use this @debt slice array ... brackets actually return a reference to an array to the scalar answer. The inner brackets access the slice array which returns an array based on the slice through the @entry array. The outer brackets return a reference to that array. my $answer = [ @entry[ @debt ] ]; Now I apply my join to a reference to an array ... @$answer to return the sliced @entry array items. print join( "\t", @$answer ), "\n"; =cut my @number = (2,3,4); my @debt = (0..4); my @entry = ("Washington", "Jefferson", "Franklin", "Adams", "Paine"); print "Some founders: ", join("\t",@entry[@number]), "\n"; my $answer = [@entry[@debt]]; print "Founding fathers: ", join("\t",@$answer), "\n"; exit(0);