Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Grepping on array

by herveus (Parson)
on May 19, 2004 at 13:08 UTC ( #354592=note: print w/replies, xml ) Need Help??


in reply to Grepping on array

Howdy!

my %first = map { $_ => 1 } @arr2; @result = grep !exists $first{$_}, @arr1;

%first is a hash whose keys are the distinct values in @arr2. The grep returns a list of the values in @arr1 that don't exist in %first, thus eliminating values in @arr2.

yours,
Michael

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2020-10-25 06:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (249 votes). Check out past polls.

    Notices?