Here's one that's driving me mad ... I'm trying to write a script and I want
the output to continue on the same line, but when I add in anything that
slows down the loop I can only get an output if I add a line feed.
(RH 6.1 and perl-5.00503-6.)
Any ideas?
Dan.
Three example are below to try and explain what I mean.
-----------------------------------------------------------------------------
#!/usr/bin/perl
while () {
print "hello world";
}
gives
o worldhello worldhello worldhello worldhello worldhello worldhello
worldhello worldhello worldhello worldhello worldhello worldhello worldhello
worldhello worldhello worldhello worldhello worldhello worldhello worldhello
worldhello worldhello worldhello worldhello worldhello wor
------------------------------------------------------------------------------
When I add something in that slows the loop down, a subroutine, or even a
simple sleep command ...
#!/usr/bin/perl
while () {
print "hello world";
sleep 1;
}
I get nothing at all, the cursor just sits there.
------------------------------------------------------------------------------
Then I add a line feed ...
#!/usr/bin/perl
while () {
print "hello world\n";
sleep 1;
}
And get this ...
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs