$str="There's many more ways to do it.\n"; $str =~ tr/\000-\xff/./; while ( $str =~ /(.)/g ) { $count++; }