chinamox has asked for the wisdom of the Perl Monks concerning the following question:
Hello again monks,
I have finished writing a program that requires <STDIN> input to function correctly. Because of this, I want the program to display a small error message when the user provides on file for the program.
For example:
username$: perl myprog.pl /path/path/file
results in the program executing as expected using the data in file. However I want this:
username$: perl myprog.pl
to cause the print out of a message simlar to this:
Error! plese try: 'perl myprog.pl /some/filename'
can this be done easly through an if-else statement? If so how should I check to see if <> is being used or not?
Thank you very much for your time.
-mox
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Returning an error message when <STDIN> is not in use
by davorg (Chancellor) on Nov 09, 2006 at 15:54 UTC | |
by jonadab (Parson) on Nov 09, 2006 at 16:02 UTC | |
by chinamox (Scribe) on Nov 10, 2006 at 05:43 UTC | |
|
Re: Returning an error message when <STDIN> is not in use
by ikegami (Patriarch) on Nov 09, 2006 at 15:49 UTC | |
|
Re: Returning an error message when <STDIN> is not in use
by ptum (Priest) on Nov 09, 2006 at 15:52 UTC | |
|
Re: Returning an error message when <STDIN> is not in use
by wjw (Priest) on Nov 09, 2006 at 15:57 UTC |