$string =~ tr/1//d; #### $string =~ s/\d//; #### $char = substr($string,-6,1,'');