in reply to Parameter passing
The only change I made was to change the call - instead of passing references in, just pass the scalars. You aren't changing the values of the variables in the subroutine - I can't see any reason why you would want to pass the references instead of the actual scalar values.my ($x, $y); if (fn($x, $y)) { die "fn() failed\n"; } # do stuff with $x and $y... exit 0; sub fn { my ($fn_x, $fn_y) = @_; ($fn_x, $fn_y) = ('x', 'y'); my $rc = 0; $rc = 1 if $fn_x ne 'x'; # never happens, just an example return 0; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Parameter passing
by gjb (Vicar) on Oct 30, 2003 at 16:11 UTC |