Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: how to delete without resulting in undef

by BrowserUk (Patriarch)
on Nov 17, 2005 at 06:27 UTC ( [id://509306]=note: print w/replies, xml ) Need Help??


in reply to how to delete without resulting in undef

You probably want to use splice which removes elements entirely from the array, rather than delete which only deletes their values:

perl> @a = (1 .. 10);; perl> delete $a[ 3 ];; perl> print "@a";; Use of uninitialized value in join or string at 1 2 3 5 6 7 8 9 10 perl> @a = (1 .. 10);; perl> splice @a, 3, 1;; perl> print "@a";; 1 2 3 5 6 7 8 9 10

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (1)
As of 2024-04-24 13:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found