#!/usr/bin/perl open(FILEID, "BreastCnAPmiRNAsID.txt") || die "cannot open file"; { open(FILECOMPARE, "tarbaseData.txt") || die "cannot open file"; { while() { chomp; $rnaid = $_; while() { chomp; print "$rnaid\n"; if (/$rnaid/) { print "$_\n"; } } close(FILECOMPARE); } close(FILEID); } }