is there anyway to compare two strings regardless of case size?
For Example
"steve" eq "STevE" <----- these would match
"SHOE" eq "shoe"
You get the picture
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
yes – use
uc()(upper-case function; see http://perldoc.perl.org/functions/uc.html )You can obviously use
lc()as well.If you want the actual “eq” operator to be case insensitive, it might be possible using overloads but I don’t think that’s what you are asking for – please clarify your question if that’s the case. Nor is it a great idea if you do want that, IMHO – too fragile and leads to major possible hard to trace and debug bugs.
Also, it’s an overkill in your specific case where you just want equality, but Perl regular expressions also have case-independent modifyer “i”