in reply to Re^3: using function delete with arrays
in thread using function delete with arrays

I know this, but:
1. if test for 'exists' returns false for deleted elements - then why scalar returns number of all elements ? (with deleted).
2. if delete realy delete last elements - why it doesn't delete middle elements ?
this is a questions about language realisation, not about how this function work.. I trying to understand for which purposes I can use this function.

Replies are listed 'Best First'.
Re^5: using function delete with arrays
by cdarke (Prior) on Jul 18, 2007 at 11:20 UTC
    why it doesn't delete middle elements ?

    That is a really good question. My best guess is that it would be useful if an array was tie'ed to a database.
    Personally I do not find delete used on an array to be particularly useful. My suggestion is that you use splice instead, which has been around much longer.
    Deleting elements from within an array is not really something that needs to be done very often, the (non-tie) cases I can think of would all be better done using a hash.