lines such as
%head_seqs = @headers_seqs;
make no sense.
It makes perfect sense. Copying values between lists, arrays and hashes is a normal idiom in Perl.
if ($line =~ /$key/) { $line =~ s/$key/$headers{$key}/; last; }
Your $key values may contain regular expression meta-characters so you should use quotemeta on them.
Your loop exits on the first match but not necessarily the correct match. You should anchor the patterns.
In reply to Re^2: replace FASTA sequence headers
by jwkrahn
in thread replace FASTA sequence headers
by onlyIDleft
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |