Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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 romping around the Monastery: (12)
As of 2014-08-01 04:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (256 votes), past polls