Re: Detecting if input is provided

2011-03-14 Thread Mark
On Mar 14, 2:06 pm, jimsgib...@gmail.com (Jim Gibson) wrote: > The standard Unix function for determining this is isatty(in fd), where fd > is the file descriptor for the input/output stream. I don't know the > equivalent in Windows. However, there is the file test operator -t that > returns true i

Re: Detecting if input is provided

2011-03-14 Thread Shawn H Corey
On 11-03-14 04:49 PM, Mark wrote: Examples where input is "provided": perl myscript.pl input.txt perl myscript.pl< input.txt executable_that_writes_to_sdtout | perl myscript.pl Example of where no input is "provided": perl myscript.pl my $has_input = 0; while( <> ){ $has_input = 1; # pro

Re: Detecting if input is provided

2011-03-14 Thread Jim Gibson
On 3/14/11 Mon Mar 14, 2011 1:49 PM, "Mark" scribbled: > I need to detect if input has been to my script or not. > > For example, I would like to differentiate between an invocation from > the two lists below: > > Examples where input is "provided": > perl myscript.pl input.txt > perl myscrip

Detecting if input is provided

2011-03-14 Thread Mark
I need to detect if input has been to my script or not. For example, I would like to differentiate between an invocation from the two lists below: Examples where input is "provided": perl myscript.pl input.txt perl myscript.pl < input.txt executable_that_writes_to_sdtout | perl myscript.pl Examp