in reply to Why doesn't this print when i omit the newline?

STDOUT is usually buffered by default. It's all queueing up until it sees a newline. Try setting $| = 1; before the loop, and add a sleep 5; between the prints. Then you should see something interesting.

-QM
--
Quantum Mechanics: The dreams stuff is made of

Replies are listed 'Best First'.
Re^2: Why doesn't this print when i omit the newline?
by karlgoethebier (Abbot) on Dec 16, 2014 at 13:30 UTC
    ..."Then you should see something interesting"

    Here we go:

    Thanks and best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      Please don't manually add line numbers to your code. Then if I want to paste it, I have to remove them again. PerlMonks has an option in your user settings to enable line numbers so that you see them next to any code segment.

      You didn't mention what output you are getting here, but on my system I immediately get the first line printed, and then five seconds later I get the first line plus a newline. Then immediately the second line, and five seconds later the second line plus a newline, and so on.

      Ubuntu Linux 14.04 with Perl 5.20.1.

      Ah, I get it... windows, and ikegami nabbed it below. :)


      Dave