http://www.perlmonks.org?node_id=273465


in reply to Autoflushing revisited.

If I remember correctly, $| sets the currently selected handle to autoflush ie. STDOUT. This means TCPDUMP is not set to autoflush, and even if it was it only is automatic when writing to it. The problem is you can't make grep and/or tcpdump autoflush by setting $|, so you're program is writing to the screen as soon as it gets the information but that takes a bit because tcpdump/grep are buffering it. Take a look at the command line args for grep/tcpdump and see if you can turn off buffering.