[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: exists $foo[7] and delete $foo[7]
Tom Christiansen writes:
: >IIRC, the current documentation says it will be fixed in a future
: >release.
:
: My copy reads:
:
: This surprising autovivification in what does not at first--or
: even second--glance appear to be an lvalue context may be fixed
: in a future release.
:
: This is *not* related to exists().
That's correct, insofar as exists() is an rvalue.
: You have to make all uses of
: the pointer arrow dereference, implicit or explicit, stop autovivifying.
:
: $x[$i][$j] += $y[$i][$j] if $z[$i][$j] < 10;
:
: That will autovivify three things. Your task, if you choose to
: accept it, it to make it autovivify but two of them.
It shouldn't autovivify on any rvalues. I only see one lvalue there,
so I only see one ref autovification (plus one array element creation).
: But there are a lot of other border situations to consider. Here's one:
:
: $x[$i][$j] =~ s/foo/bar/;
: or
: $x[$i][$j] =~ s/^//; # how no-op-py is this *really*?
Those have always been considered lvalues. Same for tr///. But not
for m//.
: And then there's this fun one:
:
: somefunc( $x[$i][$j] );
That's been considered an honorary lvalue for some time, if I recall.
Larry
- Follow-Ups from:
-
Larry Wall <larry@wall.org>
- References to:
-
Tom Christiansen <tchrist@chthon.perl.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]