in reply to Re^2: How to differentiate an empty array from an unitialized one?
in thread How to differentiate an empty array from an unitialized one?
arrays don't have a concept of "(un)defined"Yeah, that's an odd design decision which I personally disagree with. I see no logical reason to distinguish between "empty" and "undefined" for scalars, but not for arrays.
In any case, I considered going into that in my previous comment, but obviously decided against it. I probably should have, given that the literal answer to "How to differentiate an empty array from an uninitialized one?" is "You don't, because Perl doesn't."
Interesting. I wasn't aware of that behavior in split. Thanks for pointing it out!$ perl -wMstrict -MData::Dump -e 'dd split /-|(x)/, "-", -1' ("", undef, "")
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to differentiate an empty array from an unitialized one?
by choroba (Cardinal) on Jul 10, 2018 at 09:20 UTC | |
by dsheroh (Monsignor) on Jul 11, 2018 at 07:37 UTC |