$combined =~ /^(\x00*)/; my $prefix = substr($first, 0, length($1)); print qq{Prefix is "$prefix"};