"be consistent" | |
PerlMonks |
Re: counting string in a text fileby PeterPeiGuo (Hermit) |
on Jan 13, 2011 at 04:49 UTC ( [id://882029]=note: print w/replies, xml ) | Need Help?? |
You don't need to count. All you need is to find out the boundaries - where color changes. Loop through the file and store boundaries in, for example, a hash. In that hash, use line number as key, and the color as value. This way your code does not have dependency on the number of colors and it is more extensible. Peter (Guo) Pei
In Section
Seekers of Perl Wisdom
|
|