while (<$fh_log>) { my ($month, $user) = /^LOGGING: \S+?-(\S+) \S+: STARTING FLUSH: (\S+)$/ or next; $flushes{$month}{$user}++; $flushes{$month}{TOTAL}++; }