Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: BOfH Random Excuse Generatorby virtualsue (Vicar) |
on May 26, 2001 at 13:24 UTC ( [id://83486]=note: print w/replies, xml ) | Need Help?? |
This was kinda cute, even though I don't completely
understand the deal with DUMMYMODE (in the BOFH mindset,
*all* users are dummies, so that should be a design
assumption rather than a switch :)). I do have
a few suggestions for you:
Your regex has a little problem. It will match 'y' anywhere in the input, rather than at the beginning of the input string which I think is what you want. Use the ^ assertion to match at the beginning of the string. Also, if you have verified that the user has started his answer with 'y' you don't really need to check explicitly for the string 'yes'. See also the informative nodes Death to Dot Star! and Do not use diamond for STDIN. Here's a less-cluttered alternative to your while loop block: or even:
In Section
Cool Uses for Perl
|
|