in reply to Bachelor of Arts?
Indirectly, this goes toward explaining the behavior you're seeing.my $a='A'; print "".$a, $a++; __END__ AA
What's happening under the covers in
ismy $a='A'; print $a, $a++;
So how does print "".$a, $a++ help explain this? Why doesn't it also print "BA"? That's because what gets passed as a first argument is a reference to an object that represents the evaluation of "".$a. At the time the expression was evaluated, $a still held 'A'.
This behavior is hinted at in perlsub, which explains
The array @_ is a local array, but its elements are aliases for the actual scalar parameters. In particular, if an element $_[0] is updated, the corresponding argument is updated
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Bachelor of Arts?
by BrowserUk (Patriarch) on Aug 26, 2002 at 14:35 UTC |