>>>>> Alternatively, you can use the '-t' operator: >>>>> >>>>> exit 0 if -t STDIN >>>> >>>> I've been waiting for this for a LONG time, thanks Smoot. >>> >>> No problem. It took me a while to find the correct operator as well. >>> >>> Please keep in mind that doing this breaks the de facto Unix standard >>> for filters. A simply command which is a filter (e.g takes >>> input from STDIN and sends output to STDOUT) is written without any >>> consideration whether the input is a terminal, pipe, socket or >>> otherwise. This makes it very simple to use the command in a pipeline or >>> standalone from the terminal. >> >> [stuff cut out] >> >> Strangely, I find that we almost always want our scripts to act this way. >> If any files or data is passed to the script, then it uses it. Otherwise, >> it prints usage instructions (since we'd rather not have man pages for >> scripts, and I don't know how to build them anyway). > > Use POD. See 'perldoc perlpod' for all the details. > > Then the user can just run 'perldoc scriptname' (provided 'scriptname' > is in $PATH) and get a nicely formatted manpage.
Thanks for the tip, Morten, I'll look into it. The only problem I see is that my users forget things very quickly. They'll never remember "perldoc" when they forget how to use a command. The only thing I lose by doing it the way above is the ability to type a command, then have it wait for your input terminated by a ctrl-D (which my users forget too). I'll look into it, though, I hadn't even considered it. - B -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>