my $Command = '\x03'; # This is some sub-routine I am calling to send the command. SendCommand ($Command); # This Regexp never sets true which is the problem: if ($Command =~ m/\\x03/) { # it never goes in this if statement print "Matched !!"; }