Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Check if element in One Array Exist in Other Array

by gopalr (Priest)
on Oct 13, 2005 at 06:18 UTC ( #499783=note: print w/ replies, xml ) Need Help??


in reply to Check if element in One Array Exist in Other Array

Take a look at List::Compare::Functional Module.

Update

use List::Compare::Functional qw(is_LsubsetR); $test1 = ['A','D','B']; $test2 = ['A','C','B']; $source = ['A','B','C','A','B']; $result = is_LsubsetR( [ $test1, $source ] ); $result == 1 ? print "\n\$test1 is True" : print "\n\$test1 is False"; $result = is_LsubsetR( [ $test2, $source ] ); $result == 1 ? print "\n\$test2 is True" : print "\n\$test2 is False";

OUTPUT

$test1 is False $test2 is True


Comment on Re: Check if element in One Array Exist in Other 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://499783]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2015-07-28 10:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls