Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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 examining the Monastery: (13)
As of 2014-11-26 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (164 votes), past polls