in reply to Challenge - Creative Way To Detect Alpha Characters
Or an array slice variation:$H{$_}++ for split '', $str; if (grep $_, @H{a..z,A..Z}) { ... }
Update: or forget the slices (duh):$A[ord $_]++ for split '', $str; if (grep $_, @A[map ord, a..z,A..Z]) { ... }
$H{$_}++ for split '', $str; if (grep $H{$_}, a..z, A..Z) { ... }
$A[ord $_]++ for split '', $str; if (grep $A[ord $_], a..z, A..Z) { ... }
Update #2: using POSIX:
Add salt, quotes, and strict to taste.use POSIX; if ( grep { isalpha $_ } split '', $str ) { ... }
|
---|