You can force print() to print unbuffered like this:
$| = 1;
perl -e 'use v5.10; $| = 1; for (1..10) {print $_; sleep(1);}'
I was looking for a link to the docs to share with you and found this oldie but goodie from the Perl Cookbook: Recipe 7.19. Flushing Output :-)
Hope this helps!
update: Changed link to Perl Cookbook excerpt since the one I originally posted turned out to be to a pirate site! (Of course some might use the same description for Google Books ... but the ORA permission is right there.) I just thought it would be fun to post an example from a classic text; next time I'll stick to the current perldoc, I think.In reply to Re: Print vs Say with sleep function
by 1nickt
in thread Print vs Say with sleep function
by raghuprasad241
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |