http://www.perlmonks.org?node_id=11135432


in reply to Dealing with nextline of a file

Any of the "sliding window" approaches will answer your question. However, I suspect that you have an XY Problem. If you describe what you need to count, we may be able to suggest a better algorithm. My best guess is that you want the number of distinct values for the first field in your data. Can you be sure that like values are always consecutive?
Bill

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.