sub foo { if (defined wantarray) { # we're in scalar or list context my @param = @_; # make a copy of the parameters foo( @param ); # recursive call for ease of maintenance return @param; # return the result } # we only get here if in void context # do what you need to do on @_ directly, only thing to maintain } #foo