Please read How do I post a question effectively?
It sounds like you have the following:
- You have a 'Bayes' program running, writing output to a file
- After every N lines of output, you want to perform some processing
- 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... | [reply] [d/l] |
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.
| [reply] [d/l] [select] |