in reply to Re: regex search fails
in thread regex search fails

If the "solution" is
print if /\Q$pattern\E/;
then $pattern doesn't contains a regexp pattern as its name implies. The variable should be renamed
my $search_str = $1; ... print if /\Q$search_str/;
or quotemeta should be called earlier.
my $pattern = quotemeta($1); # aka "\Q$1" ... print if /$pattern/;