sub foo { my $a = shift; push @$a, "foobar"; } my @a = (); foo \@a; # passing a value that is a reference to @a print $a[1]; # prints "foobar"