$Bill Luebkert wrote:
Perl normally passes by value .
That is unaccurate : Perl always passes by reference (or rather by
alias), but we do the copy ourselves when we handle the arguments array :
@_ always has aliases on the arguments.
eg :
sub increment { $_[0]++ }
sub increment2 {
my $arg = shift;
$arg++;
}
my $one = 1;
print "ret : ", increment $one, "\n"; # "ret : 2"
print "one : $one\n"; # "one : 2"
print "ret : ", increment2 $one, "\n"; # "ret : 3"
print "one : $one\n"; # "one : 2"
--
Jedaï
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs