Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Removing elemets from an array

by davido (Archbishop)
on Dec 28, 2012 at 10:17 UTC ( #1010682=note: print w/ replies, xml ) Need Help??


in reply to Removing elemets from an array

my @arcb = ( 450, 625, 720, 645 ); my @arca = ( 625, 645 ); @arcb = do { my %exclude; @exclude{@arca} = (); grep { ! exists $exclude{$_} } @arcb; }; print "@arcb\n";

grep, and a narrowly scoped hash populated via a slice.


Dave


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://1010682]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (16)
As of 2014-07-31 19:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (252 votes), past polls