use strict; use warnings; while () { next if /^A id/; my ($x, $c1, $c2, @cols) = (split)[1..7]; print "$x: col 12, 1st: $c1\n"; for my $col (@cols) { if ($c1 == $col) { print " matches\n"; } else { print " does not match\n"; } } print "$x: col 12, 2nd: $c2\n"; for my $col (@cols) { if ($c2 == $col) { print " matches\n"; } else { print " does not match\n"; } } } __DATA__ A id 12 12 15 15 16 16 M X1 1 2 2 2 2 2 M X2 2 1 1 1 1 1 M X3 1 2 2 2 2 2 M X4 2 2 2 1 1 2