MVRS has asked for the wisdom of the Perl Monks concerning the following question:
hi monks please help me in applying this properly , i need the total number of strings ending with A in the dataset
#!/usr/bin/perl -w use strict; open DATA , "<GSE_out" or die "Can't open the file $!"; my @output = <DATA>; my $count_A = 0 ; close DATA ; foreach my $line (@output) { my $length = length ($line); if (substr($line, 0,$length) eq 'A') { $count_A++; } print $count_A++;
here is the data set
>2 AAAAAAAAACAAAAGAACGAAGAAGT >3 AAAAAAAAACAACCGAAAAATAGAAAC >4 AAAAAAAAACAAGAAGGACTAGACC >7 AAAAAAAAACAAGGACTGGTTTATCAG >8 AAAAAAAAACAAGTTTCTCTGTGACT >12 AAAAAAAAACACAGACGTAGAATTGT >14 AAAAAAAAACACGACCGTTCGCTTTGA >15 AAAAAAAAACACGACTGTTCGCTTT >16 AAAAAAAAACACTATGAGCCAGAAC
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: counting strings ending with a in dataset
by davido (Cardinal) on Feb 29, 2012 at 06:37 UTC | |
by MVRS (Acolyte) on Feb 29, 2012 at 06:52 UTC | |
|
Re: counting strings ending with a in dataset
by JavaFan (Canon) on Feb 29, 2012 at 07:35 UTC | |
|
Re: counting strings ending with a in dataset
by locked_user sundialsvc4 (Abbot) on Feb 29, 2012 at 18:56 UTC |