Why does the part I want printed out comes out with the last line duplicated in perl?

I have a uniprot document with a protein sequence as well as some metadata. I need to use perl to match the sequence and print it out but for some reason the last line always comes out two times. The code I wrote is here #!usr/bin/perl open (IN,’P30988.txt’); while (<IN>) { if($_=~m /^\s+(\D+)/) { #this… Read More Why does the part I want printed out comes out with the last line duplicated in perl?