#!/usr/bin/perl use warnings; use strict; my $filename = 'pedigree_proband_testfile.txt'; open (FILE, "<", $filename) or die "Cannot open file $!"; my @data = ; my @column; my $motherID; foreach my $line (@data) { @column = split ( /\t/, $line); if ($column[13] eq "" && $column[14] ne "" ) { print "DEBUG: $line"; # It isn't clear what you are trying to do below here $motherID = join($column[2],$column[4]); if ("$motherID" eq "$column[2]") { print "$line\t\n"; } } }