On Sep 9, Kevin Pfeiffer said:

>In article <[EMAIL PROTECTED]>, David wrote:
>
>[...]
>> [panda]$ html.pl
>> no input
>> [panda]$ html.pl file.html
>> get file file.html
>> [panda]$ echo "hi" | html.pl
>> get line hi
>> [panda]$
>>
>> perldoc -f select
>> perldoc IO::Select
>
>Thanks! This is what I was thinking of; I'll take a look.

I really that's too much work.  The -t file test should be sufficient:

  if (@ARGV) {
    # getting input via command-line arg
    $html = shift;
  }
  elsif (-t STDIN) {
    # STDIN is the user's terminal (as opposed to a piped stream)
    usage();
  }
  else {
    # the user has piped us something
    $html = join "", <STDIN>;
  }

See 'perldoc -f -X' for more details.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to