Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Removing elemets from an array

by LanX (Abbot)
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


Comment on Re: Removing elemets from an array
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2014-04-23 21:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (554 votes), past polls