$ cat j.pl my $stream = "A00010\x{1b}\x{be}\x{a}\x{81}D00318"; if ($stream =~ /^A00010.{4}/) { print "yes\n"; } else { print "no\n"; } $ perl j.pl no What?? That string doesn't start with A00010 followed by 4 somethings? j