in reply to Re: Finding a match between two paired arrays
in thread Finding a match between two paired arrays

my @a = qw(1 11); my @b = qw(1a 2b); ($a,$b) = qw(11 a); print "Why am I printing?$/" unless (exists { map { $a[$_].$b[$_] => $ +_ } 0..$#a }->{$a.$b});

Of course, if you can guarantee @a contains only numerals and @b contains no numerals, then your solution works as advertised. However, this solution does break down when either array can contain any character.

Replies are listed 'Best First'.
Re: Re: Re: Finding a match between two paired arrays
by ysth (Canon) on Jan 08, 2004 at 19:49 UTC
    Thanks for pointing that out. I was going to mention the limitation, but decided the OP's example was sufficiently exemplary.