- or download this
sub mysub {
my @array = @$_[0]; # Makes a copy. Not efficient.
...
my @a = (1 .. 10);
mysub(\@a); # \@a is a reference to the array @a.
- or download this
mysub {
my @array = @_; # Copying again. Not efficient.
...
my @a = (1 .. 10);
mysub(@a); # Send the array as @_
- or download this
mysub {
my ($arrayref) = @_;
...
my @a = (1 .. 10);
mysub( \@a );