#!/usr/bin/perl -w use strict; my @list= (1,2,3,4,5); printListRef(\@list); sub printListRef { my $listRef = shift; ########### easy way ######## print "easy way\n"; print "@$listRef\n"; ############################# #### another way (ugly)########### print "\nugly index stuff way\n"; my $i =0; foreach my $item (@$listRef) { print "list element[$i]=$item\n"; $i++; } ########## perl way for item per line ### print "\nperl way with one item per line\n"; print join("\n",@$listRef),"\n"; } ## it might not be apparent, but the __END__ ##line stopped the compilation. Another cool this about Perl. __END__ prints: easy way 1 2 3 4 5 ugly index stuff way list element[0]=1 list element[1]=2 list element[2]=3 list element[3]=4 list element[4]=5 perl way with one item per line 1 2 3 4 5