Why my Strawberry Perl act strangely under MSYS?

W

Water Lin

I use MSYS to use Strawberry Perl under Windows XP. But I found an
interesting thing under MSYS.

For there is a script test.pl, the content is:
-------------------------------------------------------------
print "The steps you can do by this auto-tool:\n";

$want_test = <STDIN>;
-------------------------------------------------------------

If I run this script in Windows cmd or Cygwin, it will print the text
"The steps you can do by this auto-tool:".

But when I try to run this script under MSYS, the console show
something like this:
-------------------------------------------------------------
$ perl test.pl
a
The steps you can do by this auto-tool:
-------------------------------------------------------------

After run comand "perl test.pl", the console ask me to input
immediately. After I input "a", the text is printed.

It is very strange. The script did right things but just asked me to
input something first!

Who has any idea about this?
 
B

Bart Lateur

Water said:
For there is a script test.pl, the content is:
-------------------------------------------------------------
print "The steps you can do by this auto-tool:\n";

$want_test = <STDIN>;
-------------------------------------------------------------

If I run this script in Windows cmd or Cygwin, it will print the text
"The steps you can do by this auto-tool:".

But when I try to run this script under MSYS, the console show
something like this:
-------------------------------------------------------------
$ perl test.pl
a
The steps you can do by this auto-tool:
-------------------------------------------------------------

After run comand "perl test.pl", the console ask me to input
immediately. After I input "a", the text is printed.

It is very strange. The script did right things but just asked me to
input something first!

Who has any idea about this?

Google for "suffering from buffering".

Likely adding this to the top of your script will fix it:

$| = 1;
 
W

Water Lin

Google for "suffering from buffering".

Likely adding this to the top of your script will fix it:

        $| = 1;

I also want a way if I don't need to add $| = 1 at the beginning of
script.

Is it possible to fix it without modify script?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top