Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Re: I think I'm close...

by grummerX (Pilgrim)
on Mar 01, 2002 at 21:08 UTC ( [id://148683]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: I think I'm close...
in thread Parsing answer for a 'yes'

The /g is Perl's global match modifier. In this case, you're only looking for a single match, so you don't need it.

I would also suggest taking the approach VSarkiss uses below and anchoring your regex:

	if ($question =~ /^y/i) ...
works great for all concerned, while this:
	if ($question =~ /(yes|y)/i) ...
not only matches, "yes" and "y", but also matches "maybe", "not necessarily", "no way", "definitely not", and "/me rolls eyes".

-- grummerX

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-19 10:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found