in reply to Sleep behavior across platforms

You are Suffering from Buffering!

Try 'unbuffering' STDOUT by setting $| to a true value:

$| = 1; print "hello\n"; sleep 2; print "goodbye";

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)