On Fri, Aug 02, 2002 at 03:11:41PM +0200, Leopold Toetsch wrote:
> John Porter wrote:
> 
> > Aldo Calpini wrote:
> > 
> >>I have to disagree. the corresponding Perl script
> >>does not show this behaviour:
> >>
> > 
> > $\ = "\n";
> > $#a = 100;
> > print scalar(@a);
> > $x = $a[10000][0];

> > Perl has to autoviv if it has to drill down.
> 
> 
> Not on reading.

It does on reading. I forget the eloquent explanation about the how or
why, but all references bar the leftmost are vivified. (Even inside
defined). In effect, all bar the last reference are in lvalue context -
only the rightmost is rvalue.

$ cat ~/test/drilldown.pl
$\ = "\n";
$#a = 100;
print scalar(@a);
$x = $a[10000][0];
print scalar(@a);
__END__
$ perl ~/test/drilldown.pl
101
10001

Nicholas Clark

Reply via email to