Enjoy,#!/usr/bin/perl use strict; use warnings; my $pip=""; my $ctr=0; while (<DATA>) { chomp; s/\.\d+$//; if ($pip ne $_ && $pip ne"") { print "$pip has $ctr entries\n"; $ctr=1; } else { $ctr++; } $pip=$_; } __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.46 192.168.10.5
In reply to Re: Summarizing an array of IP's
by johndageek
in thread Summarizing an array of IP's
by carric
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |