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