in reply to counting inside the loop
$count{$t1}++
This will have the number of occurences of each combination stored in a hash. Think about how it works and you will know where to put it. If not, try out a few locations and observe what happens. Don't forget to print out the hash after all the loops are finished.
my $count=($str2=~ tr/$t1//);
This will count how often the characters in $t1 are in $str2, i.e. if $t1 were "ab" it would count all 'a's and 'b's in $str2. Is that really what you want?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: counting inside the loop
by AnomalousMonk (Archbishop) on Jun 30, 2011 at 15:09 UTC | |
|
Re^2: counting inside the loop
by sarvan (Sexton) on Jul 01, 2011 at 11:09 UTC | |
by Anonymous Monk on Jul 01, 2011 at 11:27 UTC | |
by sarvan (Sexton) on Jul 04, 2011 at 05:19 UTC | |
by Anonymous Monk on Jul 04, 2011 at 06:22 UTC |