my $patt = shift; # e.g. 'a\Ubc' from the shell $patt = qr/$patt/; my $target = 'aBC'; print $target =~ /$patt/; # prints nothing