in reply to Re: manipulating hashes
in thread manipulating hashes

Then you're starting back at 0 for each $prot_string... I'm not sure that's what you want...You can also use index()
foreach $prot_string (@truncated_sequences) { foreach $tri_seq (@triamino_combo) { $i=-1; while(($i=index($prot_string,$tri_seq,$i)) > -1){ $tri_freq{$tri_seq}++; $i+=3; } $tri_freq{$tri_seq}='0' unless defined $tri_freq{$tri_seq}; } }