Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Match string in array

by chester (Hermit)
on Oct 03, 2005 at 19:15 UTC ( #497028=note: print w/ replies, xml ) Need Help??


in reply to Match string in array

The easy way...

use warnings; use strict; use Set::Array; my $array1 = Set::Array->new('one','red','orange','brown','green','blu +e','scarlett','fourteen'); my $array2 = Set::Array->new('red','orange','yellow','green','blue','i +ndigo','violet'); print "In array1, not in array2:\n"; print join "\n", $array1->difference($array2), "\n"; print "In array2, not in array1:\n"; print join "\n", $array2->difference($array1), "\n";

Output:

In array1, not in array2: fourteen one brown scarlett In array2, not in array1: violet indigo yellow


Comment on Re: Match string in array
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2014-07-13 14:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (250 votes), past polls