Hi, thanks for all the suggestions. I originally tried to avoid slurping the whole file into memory, but got stuck using the $. variable to address a line and the one following it.
Thanks John and Gunnar for pointing me to the right direction, and thanks to Charles for his extensive comments. - Jan Charles K. Clarkson wrote on 29.08.2004: > I'm not certain fast and good are always the same thing in >programming. Certainly, a fast solution is preferred to a slow >solution. But if the fast solution doesn't scale or if it is >hard to understand it may not be a Good Thing. > You're right. I am looking for a solution which is *both* good and faster than mine. > > From an input of: > [snip] > > From your explanation I expected to get: > [snip] > > When I ran the script I got the following output. > [snip] > > So which do you really want? > Sorry, the output of my original script is what I need. -- There are two major products that come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence. - Jeremy S. Anderson -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>