in reply to Finding a match between two paired arrays

Seems like a job for grep e.g
if( grep { $a == $a[$_] && $b eq $b[$_] } 0 .. $#a ) { # do stuff here }
See. the grep docs for more info.

Update: and here's the cleaner approach using List::Util's first (as kindly pointed out by Zed_Lopez below)

if( first { $a == $a[$_] && $b eq $b[$_] } 0 .. $#a ) { # do stuff here }
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: Finding a match between two paired arrays
by Zed_Lopez (Chaplain) on Jan 08, 2004 at 15:49 UTC

    List::Util's first function will work, too, with the advantage of exiting as soon as something's found, saving the computation of searching all of both lists every time.

      As does the OP's already existant solution :)