in reply to Summarizing an array of IP's
One more for you:
#!/usr/bin/perl use strict; use warnings; my %nodes; while ( <DATA> ) { chomp; s/\.[^\.]$//; $nodes{ $_ }++; } foreach ( sort keys %nodes ) { print "$_ $nodes{$_} nodes\n"; } __DATA__ 10.0.0.1 10.0.0.2 10.0.0.3 192.168.1.5 192.168.1.6 192.168.10.3 192.168.10.4 192.168.10.5
|
---|