in reply to Printing without a newline?
The -l command-line parameter will cause the contents of $\, undefined by default, to be assigned "\n" and also to be appended at the end of print each time it is called (see perlrun): are you using -l on your command line?
Also, setting $| to true causes unbuffered output: each print is printed whether or not it has a newline terminator. (Output is buffered by default.) See $| in perlvar and also Suffering from Buffering.
c:\@Work\Perl>perl -wMstrict -e "{ local $| = 1; ;; for my $n (reverse 1 .. 5, '(unbuffered)') { sleep 1; print qq{$n }; } } ;; for my $s ('(buffered)', 'Blast', 'Off', 'Now', qq{\n}) { sleep 1; print qq{$s }; } " (unbuffered) 5 4 3 2 1 (buffered) Blast Off Now
|
|---|