Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 browsing the Monastery: (10)
As of 2014-08-29 17:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (284 votes), past polls