Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Comparing Two arrays

by fruiture (Curate)
on Sep 19, 2002 at 15:57 UTC ( [id://199212]=note: print w/replies, xml ) Need Help??


in reply to Comparing Two arrays

Try using Perl, not C ;-)

my @array1 = qw/a b c d e f/; my @array2 = qw/ b c d /; # you see: result must be a, e and f my @in1notin2 = do { my %tmp = map {($_=>undef)} @array2; grep not exists $tmp{$_}, @array1 }; print "The elements @in1notin2 can be found in array 1, but not in arr +ay 2\n";
--
http://fruiture.de

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-26 04:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found