On Oct 29, Kingsbury, Michael said:

>open  ( LOG, "/tmp/log");
>autoflush LOG 1;
>print LOG `/path/to/2hour/process`;
>close (LOG);
>
>This doesn't generate the expected results, ie, I don't get any output until
>the end.

That's because `...` doesn't return any input until the process
finishes.  You want to use open() again.  Also, you're trying to write to
a handle you've opened for reading.

  open LOG, "> /tmp/log" or die "can't write to /tmp/log: $!";
  open PROC, "$prog |" or die "can't execute $prog: $!";
  autoflush LOG 1;
  print LOG while <PROC>;
  close PROC;
  close LOG;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **


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

Reply via email to