On Sun, 28 Mar 2004 20:01:18 -0500 "Keith P. Boruff" <[EMAIL PROTECTED]> wrote:
> What I'm trying to do though is to allow the script to read data > that's piped in but quit if there is none. > > In other words, how do I get this code: > > while(<STDIN>) > { > print $_ . "\n"; > } You can use the POSIX module's isatty function. Something like: use POSIX qw(isatty); exit 0 if isatty(STDIN); If STDIN is not a tty then it must be a pipe. Alternatively, you can use the '-t' operator: exit 0 if -t STDIN -- Smoot Carl-Mitchell Systems/Network Architect email: [EMAIL PROTECTED] cell: +1 602 421 9005 home: +1 480 922 7313 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>