Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Removing elemets from an array

by LanX (Chancellor)
on Dec 28, 2012 at 13:07 UTC ( #1010702=note: print w/replies, xml ) Need Help??


in reply to Removing elemets from an array

And for completeness, the hash slice approach:

(Nota bene: repeated array elements will be deleted)

DB<109> @arcb = ( 450, 625, 720, 645 ); => (450, 625, 720, 645) DB<110> @arca = ( 625, 645 ); => (625, 645) DB<111> @arcb{@arcb}=(); => (undef, undef, undef, undef) DB<112> @arca{@arca}=(); # EDIT: ehm ... sorry useless line... + => (undef, undef) DB<113> delete @arcb{@arca} => (undef, undef) DB<114> @arcb=keys %arcb => (450, 720)

Cheers Rolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010702]
help
Chatterbox?
[cavac]: Could some of you just log in for a second and check, for example, the tail daemon logfile?
[Eily]: congrats Discipulus :)

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2017-02-22 09:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (325 votes). Check out past polls.