in reply to Re: pruning of empty arrayrefs in nested array
in thread pruning of empty arrayrefs in nested array
The likely cause of your problems is that (despite the name) delete on an array element doesn't completely remove that element from the array, it only sets it to be undef.I certainly do not want to be nitpicking with you, but it seems to me that deleting an array element does not exactly sets it to undef, but rather to "empty slot". If you undef an array element, you obtain something like this:
whereas if you delete it (or if you don't define it in the first place), you get:DB<14> x \@a 0 ARRAY(0x6005d1060) 0 0 1 1 2 undef 3 3 4 4
It does not make a practical difference for the programmer checking if the value is defined, both values will appear to be undefined, but it seems that, internally, Perl is not doing exactly the same thing. I have no idea of what the difference is.DB<4> x \@array; 0 ARRAY(0x600500b60) 0 'O' 1 1 2 empty slot 3 3 4 4
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: pruning of empty arrayrefs in nested array
by BrowserUk (Patriarch) on Apr 26, 2015 at 21:26 UTC |