in reply to pattern match special char

As mortiz pointed out, you can use quotemeta.
#!/usr/bin/perl use strict; my $text = 'sd(sd)sd'; my $a = quotemeta( 'sd(sd)sd' ); if ($text =~ /$a/ ) { print "yes"; } else { print "no"; }