An usual trick to turnoff buffering is to set the variable $|. Add the below line at beginning of your script.
$| = 1;
This would turn the buffering off. Also refer to this excellent article by MJD explaining buffering in perl. Suffering from Buffering?