in reply to parsing with two files

How about something along the lines of i.e. untested :-), the following...
use warnings; use strict; use autodie qw/open/; open FILE, "<file1"; my %results = map { chomp; ($_ => []) } <FILE>; close FILE; open FILE, "<file2"; while (<FILE>) { next unless /^(Event|Code) -(\d+)-/; my $code = $2, next if $1 eq 'Code'; push @{ $results{$code} }, $2; } close FILE;
Obviously, you'd need to put filters in place to handle whitespace e.g. blank lines in file1...

A user level that continues to overstate my experience :-))