I copied and ran without the $|=1 and it displays the text What
is your name? and I enter na d it completes.

        I tried both from the cmd.exe and a kornshell and both wroked
the same way.

        Might it have something to do with Eclipse?

          If you have any problems or questions, please let me know.

     Thanks.

  Wags ;)
David R Wagner
Senior Programmer Analyst
FedEx Freight
1.408.323.4225x2224 TEL
1.408.323.4449           FAX
http://fedex.com/us 

-----Original Message-----
From: Chris Share [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 18, 2006 15:54
To: beginners@perl.org
Subject: More Info About $| = 1;

Hi,

I'm a C programmer teaching myself Perl. I'm working on Windows XP using
ActivePerl and Eclipse (EPIC).

I've got a question about $| = 1;

If I run the following program:

#!/usr/local/bin/perl

use strict;
use warnings;

print "What is your name? ";
my $name = <STDIN>;
chomp $name;
print "Hello, $name!\n";

the command line does nothing until I enter some text, at which point
the program runs and outputs the following:

Test
What is your name? Hello, Test!

What I don't get is why the print statement doesn't execute?

If I add $| = 1; at the top of the program this fixes the problem and
the program runs as expected.

Could someone explain what's going on here, or point me to an
explanation.

Cheers,

Chris


--
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/>
<http://learn.perl.org/first-response>



**********************************************************************
This message contains information that is confidential and proprietary to FedEx 
Freight or its affiliates.  It is intended only for the recipient named and for 
the express  purpose(s) described therein.  Any other use is prohibited.
**********************************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to