in reply to $|=1;
Hi Dean.
Setting $| to 1 will turn off line buffering. Normally, a socket will wait until the buffer has filled before sending the data. This can be a source of trouble if the receiving socket is waiting and the data hasn't been sent yet. The $| = 1 simply eliminates the wait period before it sends.
Hope this helps,
-Katie.