sub test { my @array = qw{ fish chicken pork }; # I assume it's not this simple in your real script push @array, 1; return @array; }