#!/usr/bin/perl -w use strict; my $log = './log'; my (%count, %hash); open (LOG, $log) or die "Can't open $log: $!"; while (){ foreach($_){ my ($num,$date,$time,$fw,$type,$action,$alert,$int,$dir,$proto,$src,$dst,$service,$sport,$len,$rule) = (split /;/,$_); %hash = (dest => $dst, service => $service); foreach my $key (keys %hash){ my $val = $hash{$key}; $count{$val}++; } #close foreach } #close foreach }#close while foreach my $key1 (keys %count){ print "$key1 appears $count{$key1} times\n"; } #close foreach