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