#!/usr/bin/perl use strict; use warnings; use SiteSummary; my %sitecontacts; for_all_hosts(\&handle_host); print_summary(); sub handle_host { my $hostid = shift; #print "$hostid\n"; for my $sitecontact (get_sitecontact($hostid)) { $sitecontact = "" unless defined $sitecontact; $sitecontacts{$sitecontact}++; } } sub print_summary { printf(" %-20s %5s\n", "contact", "count"); for my $sitecontact (sort keys %sitecontacts) { printf(" %-20s %5d\n", $sitecontact, $sitecontacts{$sitecontact}); } }