in reply to Interactive Perl script
Trivial example:
print "Can you read this? "; my $answer = <STDIN>; if ($answer =~ /^y(?:es)?$/i) { print "Excellent\n"; } else { print "Then how did you answer?\n"; }
This has the benefit of accepting any of y, Y, yes, YES or Yes (to name a few).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Interactive Perl script
by Irishboy24 (Sexton) on Aug 27, 2009 at 16:00 UTC |