#!/usr/bin/perl my @strings = ('testing','','testing','testing'); foreach my $string (@strings) { my $q = $string; my $test = 'testing'; warn "$test =~ /$q/?"; warn $test =~ /\Q$q\E/; } __END__ testing =~ /testing/? at tmp.pl line 8. 1 at tmp.pl line 9. testing =~ //? at tmp.pl line 8. 1 at tmp.pl line 9. testing =~ /testing/? at tmp.pl line 8. 1 at tmp.pl line 9. testing =~ /testing/? at tmp.pl line 8. 1 at tmp.pl line 9.