$combined =~ s/[^\x00].*//; #### ¢¼combined=0c0d060a183672756e33 (”Ļ ”č6run3) $combined=0a183672756e33 ( ”č6run3) Prefix is "model4r" #### ... $combined =~ s/[^\x00].*//s; ... #### $combined =~ /^(\x00*)/; my $prefix = substr($first, 0, length($1)); print qq{Prefix is "$prefix"};