in reply to Can you make this code shorter and/or quicker as well?
Perhaps the following will be helpful:
use strict; use warnings; local $/ = '>'; while (<>) { chomp; my ( $id, $seq ) = /(.+?\n)(.+)/s or next; $seq =~ s/\s+//g; print ">$id$seq\n"; }
Command-line usage: perl script.pl fastaIn [>fastaOut]
The last, optional parameter directs output to a file.
In Section
Seekers of Perl Wisdom