Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Answer: HOw do I compare two strings against to arrays respectively

( #39885=categorized answer: print w/ replies, xml ) Need Help??

Q&A > strings > How do I compare two strings against two arrays respectively? contributed by Adam

How about something like:
sub DoubleMatch { my( $item1, $item2, $array_ref1, $array_ref2 ) = @_; for( @$array_ref1 ) { if( $_ eq $item1 ) { for my $item ( @$array_ref2 ) { return 1 if $item eq $item2 } } return 0; } } # Then you can say: if( DoubleMatch( $item1, $item2, \@array1, \@array2 ) { # do stuff }
Not that I've tested that or anything.

Comment on Answer: HOw do I compare two strings against to arrays respectively
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2014-10-25 01:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (139 votes), past polls