$string =~ /^Y?X?/; substr($string, $+[0]) =~ tr/X//d;