in reply to Re: Comparing strings
in thread Comparing strings

Does @b contain regexp or strings? If it contains regexps, your second snippet doesn't work. If it contains strings, your first snippet is broken. Sounds like @b contains strings, so the solutions would be

if ($a[$i] =~ /^\Q$b[$j]\E\z/i)

and (the much faster)

if (uc $a[$i] eq uc $b[$j])

You can only omit the quoting provided by \Q...\E is you are sure @b doesn't contains any meta characters.

If @b contains regexps, the solution would be

if ($a[$i] =~ /^$b[$j]\z/i)