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

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

by gopalr (Priest)
on Oct 13, 2005 at 06:18 UTC ( [id://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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-03-28 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found