in reply to Subroutines within if statements
OT, but, your exit 0; may leave users -- those who enter "rm" for example -- believing your script failed. Better to tell them what went wrong, now that above responders have provided direct answers to your OP.
It may be well to insert something like line 2 (below):
else { print "Invalid response: use ONLY one of the following add, a, rem +ove, r\n"; exit 0; }
Test your opens, regex captures and the like before using them; TELL your users (or at least, give them a hint) how they screwed up.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: somewhat OT: Subroutines within if statements
by Joost (Canon) on Feb 21, 2008 at 22:50 UTC |