http://www.perlmonks.org?node_id=927972


in reply to fasta file

You need to check that $accession{$g} exists before using it. Something like changing the line

 if ($accession{$g} =~ m/$accession_id/i){
to
 if (exists $accession{$g} && $accession{$g} =~ m/$accession_id/i){

should do the trick.


EDIT: BrowserUK posted an answer while I was composing mine. His is more comprehensive.