Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

How to empty the buffer
Hi

I have written a program to add the strings. Now after every execution =
how to flush out the out. how
$i =3D 0;
while(<LOGFILE> )
{
$i++;
if ($i > 10)
{
last;
}
$var =3D $_;
$msg2=3D"$var\n";
}
print $msg2;

After this I want to empty the $msg2. How?

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.


Report this thread to moderator Post Follow-up to this message
Old Post
Sreedhar Kalkunte-Venkatachala
10-24-04 01:55 PM


Re: How to empty the buffer
If you are using 'strict', you must  applies '$msg2 = $var' as 'my $msg2 =
$var',
You are highly recomment to use strict, because you won't need to take care
of
this question at all, $msg2 will destroy after the sub/loop, the entire
scope ends
anyway.

For your question :

undef $msg2 ;
or
$msg2 = undef;

HTH,
Bee


----- Original Message -----
From: <Sreedhar.Kalkunte-Venkatachala@ubs.com>
To: <beginners@perl.org>
Sent: Sunday, October 24, 2004 6:36 PM
Subject: How to empty the buffer


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;

After this I want to empty the $msg2. How?

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: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>





Report this thread to moderator Post Follow-up to this message
Old Post
Bee
10-24-04 01:55 PM


Re: How to empty the buffer
Sreedhar.Kalkunte-Venkatachala@ubs.com 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;
>
> After this I want to empty the $msg2. How?
>
> Regards
> Sreedhar

$msg2 = "";

--
Flemming Greve Skovengaard                    The prophecy of the holy Norns
a.k.a Greven, TuxPower                        A tale of death and doom
<dsl58893@vip.cybercity.dk>                   Odin saw the final sign
4112.38 BogoMIPS                              The end is coming soon

Report this thread to moderator Post Follow-up to this message
Old Post
Flemming Greve Skovengaard
10-24-04 01:55 PM


RE: How to empty the buffer
thanks. problem resolved



-----Original Message-----
From: Flemming Greve Skovengaard [mailto:dsl58893@vip.cybercity.dk]
Sent: 24 October 2004 12:13
To: beginners@perl.org
Cc: Kalkunte-Venkatachala, Sreedhar
Subject: Re: How to empty the buffer


Sreedhar.Kalkunte-Venkatachala@ubs.com wrote:
> Hi
>=20
> I have written a program to add the strings. Now after every execution =
how to flush out the out. how
> $i =3D 0;
>  while(<LOGFILE> )
>                                 {
>                                 $i++;
>                                 if ($i > 10)
>                                         {
>                                         last;
>                                         }
>                                 $var =3D $_;
>                                 $msg2=3D"$var\n";
>                                 }
> 			print $msg2;
>=20
> After this I want to empty the $msg2. How?
>=20
> Regards
> Sreedhar

$msg2 =3D "";

--=20
Flemming Greve Skovengaard                    The prophecy of the holy =
Norns
a.k.a Greven, TuxPower                        A tale of death and doom
<dsl58893@vip.cybercity.dk>                   Odin saw the final sign
4112.38 BogoMIPS                              The end is coming soon

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.


Report this thread to moderator Post Follow-up to this message
Old Post
Sreedhar Kalkunte-Venkatachala
10-24-04 01:55 PM


RE: How to empty the buffer
From: Sreedhar.Kalkunte-Venkatachala@ubs.com <> 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


Report this thread to moderator Post Follow-up to this message
Old Post
Charles K. Clarkson
10-24-04 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:36 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.