[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: exists $foo[7] and delete $foo[7]
Joshua N Pritikin wrote:
> Speaking for weirdness, is anyone else concerned with the autovivication
> of intermediate steps of exists()? My expectation has always been that
> exists() does not autovivify. Once the behavior is documented, then it
> will be more difficult to fix later.
Yes, I'm concerned. I'd actually class the current behaviour as a bug.
I wasted nearly a day because of this on the first big perl program I
wrote. I use nested hashes quite often, and having to explicitly test
all the way down the tree to avoid autoconfustication is a right royal
pain, i.e.
if (! exists($h->{$a}) || ! exists($h->{$a}{$b}) || !
exists($h->{$a}{$b}{$c}))
instead of the much more obvious
if (! exists($h->{$a}{$b}{$c}))
Alan Burlison
- Follow-Ups from:
-
Gurusamy Sarathy <gsar@ActiveState.com>
- References to:
-
london@pixelmagic.com
Larry Wall <larry@wall.org>
Joshua N Pritikin <joshua.pritikin@db.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]