I'm have a very pecular problem when using <STDIN>...
I'm running Eclipse 3.2 & E.P.I.C. 0.5.12, on XP
here's the code ....
#! /usr/bin/perl
print "Enter the string and the number (separate lines):\n";
$strings = <STDIN>;
chomp($repeat = <STDIN>);
print "Here's your output:\n";
print $strings x $repeat;
when I run this code through the console in Eclipse the prgram blocks for the first <STDIN> without printing the first line of text.
I get the following in the console.....
Robert
4
Enter the string and the number (separate lines):
Here's your output:
Robert
Robert
Robert
Robert
When I run this on through cmd.exe it runs normally, i.e. it prints a prompt to the user first, then blocks. Also runs fine on a Solaris terminal.
Please let me know what I can do...
thanks,
blkdog -
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is a FAQ. Read man perlvar for an explanation on why and when $| = 1 is necessary.
Because so many people run into it, I am going to fix it in some near future. That is, I am going to make Perl invoked by EPIC behave as if it was writing to a real terminal if the Console option is enabled in the launch configuration.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm have a very pecular problem when using <STDIN>...
I'm running Eclipse 3.2 & E.P.I.C. 0.5.12, on XP
here's the code ....
#! /usr/bin/perl
print "Enter the string and the number (separate lines):\n";
$strings = <STDIN>;
chomp($repeat = <STDIN>);
print "Here's your output:\n";
print $strings x $repeat;
when I run this code through the console in Eclipse the prgram blocks for the first <STDIN> without printing the first line of text.
I get the following in the console.....
Robert
4
Enter the string and the number (separate lines):
Here's your output:
Robert
Robert
Robert
Robert
When I run this on through cmd.exe it runs normally, i.e. it prints a prompt to the user first, then blocks. Also runs fine on a Solaris terminal.
Please let me know what I can do...
thanks,
blkdog -
Just a thought, but have you tried turning on autoflush at the beginning of your script?
$| = 1;
That worked, Thank-you, ... is this always necessary?
This is a FAQ. Read man perlvar for an explanation on why and when $| = 1 is necessary.
Because so many people run into it, I am going to fix it in some near future. That is, I am going to make Perl invoked by EPIC behave as if it was writing to a real terminal if the Console option is enabled in the launch configuration.