From: [EMAIL PROTECTED] <> wrote: : Hi : : I have written a program to add the strings. Now after every : execution how to flush out the out. how : $i = 0; : while(<LOGFILE>) : { : $i++; : if ($i > 10) : { : last; : } : $var = $_; : $msg2="$var\n"; : } : print $msg2;
You have coded an algorithm which prints the tenth line in a file. The loop just discards the next 9 lines. Then you print out the tenth line. Since you referred to a buffer, I doubt that is what you were trying to accomplish. # Discard next 9 lines <LOGFILE> foreach 1 .. 9; print scalar <LOGFILE>, "\n"; HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>