Simplified your code, that is : print foreach @buffer;
my $i; while(<LOGFILE>) { $i++; last if ($i > 10); print; } I can't see anything make sense to make the thing @buffer be in pair with <LOGFILE>. The first loop and the second don't related to each other at all... What do you expect ? Could you show some data you are dealing with ? Regards, Bee ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, October 23, 2004 7:06 PM Subject: How to store the out put in StringBuffer Hi Say I have program like this If I Say print It prints each line. How to store the both output in one string buffer ($previousLine and $var) For example I have written this program ======================================== foreach $previousLine (@buffer) { $j++; print "$previousLine"; } $i = 0; $pos = tell LOGFILE; while(<LOGFILE>) { $i++; if ($i > 10) { last; } $var = $_; print $var; } ======================================== Regards Sreedhar Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>