There might be a command line option to make
tcpdump output non-buffered. Looking at the
man page,
-U (packet-buffered) looks promising. Alternatively, take a look at
-c (exit after receiving count packets) and
-G (rotates the dump file specified with the -w option every
rotate_seconds second).
I would also like to point out that there's a good Perl module for Pcap, which is what tcpdump is built around: Net::Pcap.