#!/usr/bin/perl use strict; use warnings; my (@genes, %tested); while (<>) { s/^>//; my ($col1, $col2) = split; push @genes, $col1; $tested{$col2}++; } { local $\ = "\n"; for (@genes) { print if not $tested{$_}; } } #### C:\Old_Data\perlp>type o33.txt >chr9:133738100-133738472_0 chr20:62159728-62161126_840 >chr9:133738100-133738472_60 chr2:215589720-215676478_59220 >chr9:133738100-133738472_120 chr2:215589720-215676478_59160 >chr9:133738100-133738472_180 chr15:99500240-99507809_0 >chr9:133738100-133738472_240 chr2:215589720-215676478_59100 >chr9:133738100-133738472_253 chr1:162745876-162746210_215 >chr9:133747466-133747650_0 chr5:108523084-108532592_960 >chr9:133747466-133747650_60 chr20:62159728-62161126_900 >chr9:133747466-133747650_65