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>


Reply via email to