$a = qr{\QHello# World\E}x; $b = qr{Hello\#\ World}x; $test = "Hello# World"; $test =~ $a && print "\$a matches \$test\n"; $test =~ $b && print "\$b matches \$test\n"; print "\$a = $a\n\$b = $b\n";