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