Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Question - Trouble using IDE 1

Status
Not open for further replies.

ChrisW75

Programmer
Dec 22, 2003
727
AU
Hiya, I'm completely new to Perl (Day one of "Teach yourself in 21 days"). I've played a little and written a couple of short scripts, and I'm used to programming (SAS and VB programmer).

So, I'm learning Perl, and I've coded one of the example scripts from the book, it works fine when submitted from the command line, but in both the IDEs I've tried using it doesn't work the way I expect.
Here's the code:-
Code:
# echo the input line to the output
print 'Echo? ';
$input = <STDIN>;
print $input;
Pretty damned basic. When I run it from the command line, it prints "Echo? " and waits for my prompt. When I run it in either SciTe or Open Perl IDE, it waits for my prompt, THEN prints "Echo? "
IE, in DOS, I get this afterwards:-
Code:
Echo? This works
This works
In the IDE I get this:-
Code:
This doesn'tEcho? This doesn't

Any ideas? It's no point me using an IDE for developing if I can't rely on it performing the same way as it will when I run the prog for real.
 
Awesome that worked. I was giving up hope as the doco mentioned that this happened, but not a way to work around it. Thanks for that.
Would you be able to explain WHY that worked? IE, what does that do?
Cheers
 
Go to and get the latest perl distribution there, including the documentation. It includes excellent tutorials, and docu for everything. Amongst others, the "parlvar" document about perl predefined variables. It says:

$|
If set to nonzero, forces a flush right away and after every write or print on the currently selected output channel. Default is 0 (regardless of whether the channel is really buffered by the system or not; $| tells you only whether you've asked Perl explicitly to flush after each write). STDOUT will typically be line buffered if output is to the terminal and block buffered otherwise. Setting this variable is useful primarily when you are outputting to a pipe or socket, such as when you are running a Perl program under rsh and want to see the output as it's happening. This has no effect on input buffering. See getc in the perlfunc manpage for that. (Mnemonic: when you want your pipes to be piping hot.)
 
Cool, thanks for that. I'm actually using PXPerl and have the latest distro of that. I just haven't got enough overall knowledge yet ot be able to look at something odd and know where to look for the answer. I'm getting there, nearly finished Day 2 in between setting up and running SAS jobs...
 
Status
Not open for further replies.

Similar threads

Replies
1
Views
348
Replies
1
Views
500

Part and Inventory Search

Sponsor

Back
Top