Just another Perl shrine | |
PerlMonks |
Re^5: how to count the number of repeats in a string (really!)by lodin (Hermit) |
on Nov 15, 2007 at 00:00 UTC ( [id://650875]=note: print w/replies, xml ) | Need Help?? |
The kramba subroutine suffers from an accumulating %count. It can be fixed by doing %count = () and returning { %count } (a copy of %count); making %count global and localizing it; or my favourite: write the recursive subroutine as an anonymous closure in kramba. lodin
In Section
Seekers of Perl Wisdom
|
|