for my $host (keys %hosts) { next if $hosts{$host} == $table_count; delete $hosts{$host}; }