in reply to Finding out what computer does NOT have certain data

Let's suppose you read your "file two" first, like this:
open( P, "<", "Two.txt" ) or die "Two.txt: $!"; my @patches = sort <P>; chomp @patches; close P; my %patch_id; my $seq_num = 0; $patch_id{$_} = $seq_num++ for ( @patches );
That assigns a numeric ID (from 0 to N-1) to each of the N patch names listed in that file, in sorted order. Now read "file one" like this:
my %comp_patch; # will be a hash of arrays my $comp_name; # will store most recently seen computer name open( C, "<", "One.log" ) or die "One.log: $!"; while (<C>) { chomp; if ( /^KB\d+/ ) { # this is a patch name if ( not exists( $patch_id{$_} )) { warn "Computer $comp_name has unknown patch: $_\n"; next; # (might want to do something else here) } $comp_patch{$comp_name}[$patch_id{$_}] = $_; } elsif ( /^\S+/ ) { # not a patch name, must be a computer name $comp_name = $_; } }
For each computer, you now have an array of patches, with array elements 0 through N-1. But if a given computer did not have a particular patch, the corresponding array index in the HoA structure will be undef. So that is what you check for, to see which patches are missing from each computer:
for my $cname ( sort keys %comp_patch ) { for my $pnum ( 0 .. $#patches ) { print "$cname lacks $patches[$pnum]\n" unless ( defined( $comp_patch{$cname}[$pnum] )); } }
(untested)