$formula = $bit = '(4+5)'; if( $formula =~ /\Q$bit\E/ ) { print "yeah\n"; } else { print "Oh no!\n"; }