UPDATE: This is my 100th post! :))
Yes, but think about buffering. Perl won't flush it's buffer until it sees a newline.
You have no
\n after the
<br>, so this is what happens:
- perl fills the buffer
- perl sleeps for two seconds
- perl appends to the buffer, and then flushes it because the end of the script is reached.
Which of course is not what you want.
You could put a
\n after the
<br>, or turn on the autoflush using
$| = 1 (often seen obfuscated as
$|++).
print "First<br>\n";
sleep 2
print "Second\n";
###
$| = 1;
print "First<br>";
sleep 2;
print "Second";
I recommend the newline solution, because HTML doesn't care about the newline being there, and autoflushing decreases performance.
Information about
$| and many other special variables can be found in
perlvar.
2;0 juerd@ouranos:~$ perl -e'undef christmas'
Segmentation fault
2;139 juerd@ouranos:~$