RE: How to store the out put in StringBuffer

From: Sreedhar Kalkunte-Venkatachala (Sreedhar.Kalkunte-Venkatachala_at_ubs.com)
Date: 10/24/04


Date: Sun, 24 Oct 2004 11:17:31 +0100
To: <zeus.odin@verizon.net>, <beginners@perl.org>

Hi

thanks. problem resolved

I have added variable called $msg1.=$previousline;

Regards
Sreedhar

-----Original Message-----
From: Zeus Odin [ mailto:zeus.odin@verizon.net]
Sent: 23 October 2004 22:40
To: Kalkunte-Venkatachala, Sreedhar; beginners@perl.org
Subject: RE: How to store the out put in StringBuffer

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: Sreedhar.Kalkunte-Venkatachala@ubs.com
[ mailto:Sreedhar.Kalkunte-Venkatachala@ubs.com]
Sent: Saturday, October 23, 2004 12:38 PM
To: zeus.odin@verizon.net
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: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
< http://learn.perl.org/> < http://learn.perl.org/first-response>
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.


Relevant Pages

  • RE: How to store the out put in StringBuffer
    ... print $_ foreach @tail; this in a variable. ... How to store the out put in StringBuffer ... E-mail transmission cannot be guaranteed to be secure or error-free as ... The sender therefore does not accept ...
    (perl.beginners)
  • RE: How to store the out put in StringBuffer
    ... How to store the out put in StringBuffer ... print CHAT "text in chat" ... E-mail transmission cannot be guaranteed to be secure or error-free as ... The sender therefore does not accept ...
    (perl.beginners)
  • RE: How to store the out put in StringBuffer
    ... print CHAT "text in chat" ... How to store the out put in StringBuffer ... E-mail transmission cannot be guaranteed to be secure or error-free as ... The sender therefore does not accept ...
    (perl.beginners)
  • RE: Storing Chinese data in Char/Varchar dat types
    ... You need to store that data in ncahr/nvarchar fields. ... Regards ... But when I try to insert same chinese data to ...
    (microsoft.public.sqlserver.server)
  • Re: info store stopped unexpectedly
    ... Regards ... >> Ben Hoffman ... see Help and Support Center at ... >>> The Microsoft Exchange Information Store service terminated ...
    (microsoft.public.exchange.admin)