Skip to content

Instantly share code, notes, and snippets.

@AndrewRussellHayes
Created November 19, 2013 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewRussellHayes/7547982 to your computer and use it in GitHub Desktop.
Save AndrewRussellHayes/7547982 to your computer and use it in GitHub Desktop.
messing around with passing a perl array by reference
@arr = qw(1 2 3 4 5 6 7 8 9 10);
use Data::Dumper;
#print Dumper(@arr);
printme(1,2,\@arr,4);
sub printme
{
$varone = $_[0];
$vartwo = $_[1];
@varthree = @{$_[2]};
$varfour = $_[3];
print "$varone\n";
print "$vartwo\n";
print "dumper: ".Dumper($_[3])."\n";
print "foreach: ";
foreach $item (@varthree)
{
# print "line\n";
print "item $item\n"
}
print "\n$varfour\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment