Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: delete(), but for arrays

by demerphq (Chancellor)
on May 16, 2002 at 19:09 UTC ( #167084=note: print w/replies, xml ) Need Help??


in reply to delete(), but for arrays

Well, as the following shows delete() does not do anything like splice does on an array. Rather it is exactly the same as undefing the element in question. No reordering of the array is done as would be in splice. (In fact it was the impact of this confusion that lead to the debate about whether it should be allowed or not)
my @array=(0..9); delete $array[5]; print "'$_'\n" foreach @array; __END__ '0' '1' '2' '3' '4' '' '6' '7' '8' '9'
HTH

Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://167084]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2022-05-24 00:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (82 votes). Check out past polls.

    Notices?