The following should do what you want. @print is an array of array references. You have to read the documentation, learn what it is, and how to use it. Now would be a good time to learn the Perl debugger so you can step through my code. Your assignment is to print @print in your DoChat() routine. (After all, I can't very well write the whole thing for you) ;-)
@print is the buffer you keep referring to: ------------------- #!/usr/bin/perl use warnings; use strict; my(@tail, @print); open LOG, 'mastering.txt' or die "Could not open log file: $!"; while (<LOG>) { push @tail, $_; shift @tail if @tail > 10; if (/error/) { my($line); for (1 .. 10) { push @tail, $line if defined($line = <LOG>); } push @print, [ @tail ]; @tail = (); } } DoChat() ------------------- Good luck, ZO -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Saturday, October 23, 2004 12:38 PM To: [EMAIL PROTECTED] Subject: RE: How to store the out put in StringBuffer Hi Thank you very much for the mail. Say in the for loop it is printing var1 --> 1 var2 --> 2 var3 --> 3 var4 --> 4 var5 --> 5 var6 --> 6 How to store var1,2,3,4,5,6 to one variable --> $Newvar should print 1 2 3 4 5 6 A buffer kind i.e 6 lines is should store in one variable. Am I asking some thing wrong regards Sreedhar -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>