Think about Loose Coupling | |
PerlMonks |
Re: Check if a variable contains only one letter?by Yary (Pilgrim) |
on May 02, 2014 at 15:56 UTC ( [id://1084803]=note: print w/replies, xml ) | Need Help?? |
(edit) I have to now agree with the other posters, that my interpretation of the question is just one of many. The below is a simple answer to one of those interpretations.
I can't believe everyone's missed the obvious!
If you want to try putting it all in one regexp, see this meditation- Matching and nonmatching multiple regexps at once And if you want it to be Unicode-safe, not just matching ASCII- I'm sure it can be and should be done, but I'm not the one to ask... (edit #2) And if you really want to know if a string is a single letter X then don't use regexp. $myvar eq 'X'
In Section
Seekers of Perl Wisdom
|
|