In article <c08eug$ml5$>,
Ben Morrow <> wrote:
: (Walter Roberson) wrote:
:> perl, though, implicitly passes a reference if possible, and
:> otherwise passes by value.
:Eh what? Perl always passes aliases into @_, and the standard idiom

f
:my ($a, $b) = @_;
:then makes copies. What's implicit about that?
It is implicit compared to (say) Pascal's "VAR" notation, or even
compared to C's (type *) notation. The closest, I guess, would
be FORTRAN's behaviour.
I've had a number of practically untracable bugs, with values
used in one subroutine suddenly reappearing in the next subroutine
down -- even though the calling routine has the right value for
the parameter. I eventually decided it was happening mostly in places
I was using the (shift) idiom, and re-wrote all of those.
[I -think- I also had it happen a few times where I used my $var = $_[0]
but I'm not positive about that.] Looking back over the documentation
of shift, it seems to me that it must be the case that shift preserves
the property of being an alias, and that for my $var = shift
that $var ends up an alias to the parameter passed down. That's
certainly not explicit behaviour.
--
"Mathematics? I speak it like a native." -- Spike Milligan