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


in reply to Re^4: Autoflush fails
in thread Autoflush fails

However, the results are buffered if I pipe it to "perl -pe 1"

You'll find they're probably buffered if you pipe to anything ( even cat )

So the solution is to ddg://tcpdump buffered and find tcpdump: Re: pipeline buffering which says

if you don't specify -w, -U means "flush the standard output after the information for each packet is printed"

So there you have it, install sufficiently modern version of tcpdump that comes with -U option that flushes more often

FYI there also exists pcapdump, Net::Pcap::Easy... Tutorials: Network Programming: Perl and Net::Pcap