Help for this page
my %service = qw( 0050 www ... ); my $match_lst = join "|", keys %service; my $match = qr/:($match_lst)\s/;
foreach my $line (grep /\b01\s/, `cat /proc/net/tcp` ) { ++$count{$service{$1}} while $line =~ /$match/g; }