Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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 browsing the Monastery: (4)
As of 2023-10-03 07:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?