#!/usr/bin/perl use strict; use warnings; open PO, "netstat -na|" or die "Can't pipe open: $!\n"; my %count; while (<PO>) { next unless /^udp/ or /^tcp/; my @fields = split; # split $_ on whitespace $count{$fields[3]}++; ## next jumps here } close PO; for my $ip (sort keys %count) { print "\t$count{$ip} $ip\n"; }
Have a nice day, j
In reply to Re^3: simple question about printing vars
by reisinge
in thread simple question about printing vars
by httpd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |