$H{$_}++ for split '', $str; if (grep $_, @H{a..z,A..Z}) { ... }