#!/usr/bin/perl use strict; use Data::Dumper; my %ID = (); my $fileID = 'BreastCnAPmiRNAsID.txt'; open FILEID, '<', $fileID or die "cannot open $fileID"; while (){ chomp; $ID{$_}=1 if $_; } close FILEID; #print Dumper \%ID; my $fileCompare = 'tarbaseData.txt'; open FILECOMPARE, '<', $fileCompare or die "cannot open $fileCompare"; while(){ chomp; my @col = split "\t",$_; print "$col[2]\n"; if (exists $ID{$col[2]}){ print $_; } } close FILECOMPARE;