Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Case insensitive string compare

by Kanji (Parson)
on Aug 09, 2003 at 05:13 UTC ( [id://282379]=note: print w/replies, xml ) Need Help??


in reply to Case insensitive string compare

As pzbagel noted, you need =~ to match against your regex, although I'd modify your regex to be /^y(es)?$/ to allow for both 'yes' and 'y' as valid answers.

Alternately, and if 'yes' is the ONLY valid answer, then you can use an eq comparison by forcing the case of your input with lc().

if( lc($test) eq 'yes' ) { ... }

    --k.


Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://282379]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-24 03:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found