in reply to Re: Check if a variable contains only one letter?
in thread Check if a variable contains only one letter?
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