Perl Shell - A Solution

$| = 1;

This sets a special flag that tells Perl to use unbuffered output. This is simply a robustness feature to ensure that things are always printed inthe proper order. Without it, psh script files that intermix Unix and Perl commands may have their output mixed, since the Unix output appears immediately (unbuffered) and the Perl output appears only after a certain amount has accumulated (buffered).