Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2016-07-24 11:32 GMT
Find Nodes?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?

    Results (221 votes). Check out past polls.