my $num_keys = keys %output; print "$num_keys in output\n"; for my $key (keys %output) { print "$key,$output{$key}\n"; }