in reply to Beginner question hash&RegEx

$hash{$1}++ if ($line =~ /.*:(.{4})\/.{2}\/.{2}:.*$/)
First, $line (the current line) is matched against the regex /.*:(.{4})\/.{2}\/.{2}:.*$/, which looks for a colon, 4 characters, a slash, 2 characters, another slash, 2 characters, and a colon. If there is a match, the set of 4 characters is remembered in $1, and that value is used to increment the associated value in the hash.

For instance, if the current line is foo,bar,baz:2002/12/12:feeble it captures the 2002, and increments $hash{2002} with one.

print "In the Year 2002 you checked $hash{ 2002 } exams! \n";
This is just a simple print statement, interpolating the value $hash{2002}.

Abigail