$hash{$1}++ if ($line =~ /.*:(.{4})\/.{2}\/.{2}:.*$/) #### print "In the Year 2002 you checked $hash{ 2002 } exams! \n";