Don't ask to ask, just ask | |
PerlMonks |
Re^2: Check if a variable contains only one letter?by DrHyde (Prior) |
on May 06, 2014 at 10:38 UTC ( [id://1085158]=note: print w/replies, xml ) | Need Help?? |
Or if you don't know what the letter is ... if($myvar =~ /^([A-Za-z])\1*$/) { ... } That is, match the beginning of the string, then any letter, then any more of that same letter, then the end of the string. Adapt as appropriate for Unicode abominations.
In Section
Seekers of Perl Wisdom
|
|