my $num_chars = 0; <>; while ( <> ) { do {print "$num_chars\n"; $num_chars = 0; next} if /^>/; $num_chars += tr/ACGT/ACGT/; } print "$num_chars\n"; #### my @num_chars = (); my $i = -1; while ( <> ) { $i++, next if /^>/; $num_chars[$i] += tr/ACGT/ACGT/; } foreach ( @num_chars ) { print "$_\n"; }