in reply to How can I get correct result in counting 3-letter words?
As 2teez points out, some three-letter words do occur more than once and a hash for counts rather than individual scalars is the way to go. You could use the glob function for initialization, saving a lot of fiddly, error-prone typing.
my %threeLtrCts = map { $_ => 0 } glob q{{A,T,G,C}{A,T,G,C}{A,T,G,C}};
I hope this is helpful.
Cheers,
JohnGG
|
|---|