why did it work on V5.6 but no V5.8?
The rules regarding automatic flushing of the STDOUT buffer changed from perl-5.6 to perl-5.8. Setting $| (or incrementing it from 0 to 1, as per BrowserUk's approach) is the way to make sure that the perl-5.8 STDOUT buffer gets flushed in much the same way as happened automatically with perl-5.6.
For a simple demo of the difference, the following outputs hellogoodbye on 5.6, but goodbyehello on 5.8:
perl -e "print STDOUT \"hello\";print STDERR \"goodbye\""
Setting $| will ensure that hellogoodbye is output on both 5.6 and 5.8:
perl -e "$|=1;print STDOUT \"hello\";print STDERR \"goodbye\""
Cheers, Rob |