in reply to sampling with perl script

Please read How do I post a question effectively? It sounds like you have the following:
  1. You have a 'Bayes' program running, writing output to a file
  2. After every N lines of output, you want to perform some processing
  3. This processing is to be done via a perl program
Is this right? If so, the easiest thing to do would be something like
open BAYES, "tail -f bayes.out |" || die "could not open: $!"; while (<BAYES>) { # read until you have enough to process }
If this is not right, you will need to provide a better explanation...

Replies are listed 'Best First'.
Re^2: sampling with perl script
by Fletch (Bishop) on Oct 16, 2008 at 20:09 UTC

    Of course open BAYES, "tail -f bayes.out |" or die "could not open: $!"; would work even better as it lacks the subtle precedence problem that makes the error checking get optimized away . . .

    (Or one could be fashionable and go for a 3-argument, lexical filehandle form open my $bayes, "-|", qw( tail -f bayes.out ) or die "Couldn't open pipe: $!"; if you're into that kind of thing and have a recent enough perl.)

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.