sub parse_file { my $filename = shift; my %hash; open my $fh, '<', $filename or die $!; local $_; while (<$fh>) { (my $key, $_) = split /\|/, $_, 2; s/\r\n$/\n/; $hash{$key} = $_; } return \%hash; } my $hTryptic = parse_file $ARGV[0]; my $hSemiTryptic = parse_file $ARGV[1];