use strict; use warnings; my $count_A = 0; while ( my $line = <DATA> ) { next if $line =~ m/^>/; # This line probably unnecessary if your d +ata set is as well-behaved as it looks. $count_A++ if $line =~ m/A$/; } print "$count_A\n"; __DATA__ >2 AAAAAAAAACAAAAGAACGAAGAAGT >3 AAAAAAAAACAACCGAAAAATAGAAAC >4 AAAAAAAAACAAGAAGGACTAGACC >7 AAAAAAAAACAAGGACTGGTTTATCAG >8 AAAAAAAAACAAGTTTCTCTGTGACT >12 AAAAAAAAACACAGACGTAGAATTGT >14 AAAAAAAAACACGACCGTTCGCTTTGA >15 AAAAAAAAACACGACTGTTCGCTTT >16 AAAAAAAAACACTATGAGCCAGAAC
Dave
In reply to Re: counting strings ending with a in dataset
by davido
in thread counting strings ending with a in dataset
by MVRS
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |