in reply to Re: Re: Re: flip-flop operator and sequence number
in thread flip-flop operator and sequence number
Er, actually, I feel like a hobbit being caught red handed meddling in the affairs of wizards, which are, as everybody knows, subtle and quick to anger.
I tried and fiddle a bit with this and it's somewhat interesting. @_ is not itself aliased with the list of arguments. But each element of @_ is individually aliased with each argument. That means that you can't change the list itself (i.e. the number of its elements), but you can the values of each element. If I do:
sub { pop; shift; }->(@array);
It'll leave @array unharmed. OTOH, if I do:
sub { $_[0] = 'whatever' }->(@array);
It will change the first element of @array. You can combine both (although I would not recommend it):
sub { shift; $_[0] = 'whatever' }->(@array); # changes the *second* element of @array
--bwana147
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: flip-flop operator and sequence number
by John M. Dlugosz (Monsignor) on Jun 28, 2001 at 20:10 UTC |