open BAYES, "tail -f bayes.out |" || die "could not open: $!"; while () { # read until you have enough to process }