[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: exists $foo[7] and delete $foo[7]
Hi,
Tom Christiansen:
> Now, could someone please tell me what to fill in for XXXXX?
>
Nothing. There's nothing there, not even an undef() or an empty string.
That's why the array gets shorter if you delete its last value.
It's the same thing that's in $foo{bar} if @foo is (one=>1,two=>2,three=>3).
Beginners might find it suspicious that delete($a[2]) doesn't drop $a[3]
into the [2] slot instead, admittedly. The analogy I'd use is that arrays
are horizontal, and thus gravity won't pull them down. ;-)
--
Matthias Urlichs | noris network GmbH | smurf@noris.de | ICQ: 20193661
The quote was selected randomly. Really. | http://www.noris.de/~smurf/
--
Let's flush this toilet.
-Noah
- References to:
-
Tom Christiansen <tchrist@chthon.perl.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]