#!/usr/bin/perl -w use strict; use warnings; use Net::PcapUtils; my $pk_descr = Net::PcapUtils::open(FILTER => 'ip'); my $period = 1; my $now = time; my $till = $now + (60 * $period); my ($packet, %header); while (($now = time) < $till) { ($packet, %header) = Net::PcapUtils::next($pk_descr); print "Got packet: $packet !!!"; }