foreach $term (@terms) { if ($nTermHits {$term} > 0) { printf "%s\t%d\n", $term, $nTermHits {$term}; } }