Take a look at Re^2: Perl stdout timing/formatting.
James
In reply to Re: baudrate issue with script by jmlynesjr in thread baudrate issue with script by motoprog