in reply to Re: Re: counting occurances
in thread counting occurances
<FILE>; # ignore first line my @words = (A, C, G, T); #letters to search my @file = do {local $/; split (//, <FILE>); }; #split each letter int +o an array foreach $file (@file){ foreach $words (@words){ if ($file eq $words){ $word_list{$file}++; } } } @pairs = sort {$a->[1] <=> $b->[1]} map {[ $_ => $word_list{$_}]} keys %word_list; print "word $_->[0] = $_->[1]\n" for @pairs;
|
|---|