in reply to Re^2: How to compare two associative arrays efficiently
in thread How to compare two associative arrays efficiently

It can be loaded either way. It's totally up to you how you store the info in the hash.

Anyway, here's code that should accomplish your goal.

use strict; use warnings; my $fn_assn = ...; my $fn_pssn = ...; my @assns; { open(my $fh_assn, '<', $fn_assn) or die("Unable to open assn file \"$fn_assn\": $!\n"); chomp(@assns = <$fh_assn>); } my @pssns; { open(my $fh_pssn, '<', $fn_pssn) or die("Unable to open pssn file \"$fn_pssn\": $!\n"); chomp(@pssns = <$fh_pssn>); } { my %pssns = map { $_ => 1 } @pssns; my @unique_assns = grep { not exists $pssns{$_} } @assns; print("The following ASSNs have no corresponding PSSNs:\n"); print("$_\n") foreach @unique_assns; } print("\n"); { my %assns = map { $_ => 1 } @assns; my @unique_pssns = grep { not exists $assns{$_} } @pssns; print("The following PSSNs have no corresponding ASSNs:\n"); print("$_\n") foreach @unique_pssns; }