Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: counting string in a text file

by PeterPeiGuo (Hermit)
on Jan 13, 2011 at 04:49 UTC ( [id://882029] : note . print w/replies, xml ) Need Help??


in reply to counting string in a text file

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