# Using the same data structures as above ... foreach my $value (sort keys %file2) { unless ($file1{$value}) { print FILE3 "$value\n"; } }