in reply to Keeping a count of matches in a hash that satisfy more than 1 condition
When I started this I thought it would come out smaller than this. Thought someone might find it useful or make it a bit smaller.my $count = { "Menu" => { "Count" => 0, "Voice" => 0, "NoVoice" => 0}, "Video" => { "Count" => 0, "Voice" => 0, "NoVoice" => 0} }; foreach my $entry (values(%$file)) { $count->{$entry->{FILETYPE}}->{"Count"}++; if($entry->{VOICEOVER} eq "No") { $count->{$entry->{FILETYPE}}->{"NoVoice"}++ } else { $count->{$entry->{FILETYPE}}->{"Voice"}++ } } # Example getting one of the counts out. print $count->{"Menu"}->{"Count"} . "\n";
|
---|