sub add2arr { my ($value,@tmp) = @_; push(@tmp,$value); return @tmp; } # and call it like @tmp = add2arr($value,@tmp)