use strict; my $port = shift; our $stopit = 0; $SIG{INT} = sub { $stopit++; }; if (!$port or $port =~ /\D/) { print "usage: program port_num\n"; } else { while (!$stopit) { print system("netstat -an | grep $port"), "\n"; sleep 10; } }