A more general solution is to write your regex to find the sequence ID rather than removing the '>' character.
$pattern = qr/^(\w*)/; if ($line =~ /$pattern/) { my $id = $1; $I++; print "$i: $id \n"; }
This approach would exclude the optional sequence description if it were included in the fasta file.
UPDATE: AnomalousMonk is correct. I accidentally omitted the '<' from my regex.
In reply to Re: Pattern finding and printing with regex
by BillKSmith
in thread Pattern finding and printing with regex
by kernelpanic@thedisco
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |