Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by Adam (Vicar)
on Nov 03, 2000 at 23:30 UTC ( #39885=categorized answer: print w/replies, xml ) Need Help??

Q&A > strings > How do I compare two strings against two arrays respectively? - Answer 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 meditating upon the Monastery: (9)
As of 2016-10-01 17:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (579 votes). Check out past polls.