Aaron, that grep line looks promising (short and 'simple' - I like that!). I do not really understand it, but I want to, so I will review grep in perldocs and elsewhere and hopefully be able to decipher the line so I will be able to adapt it to my needs in the future.
Thanks so much!
To everyone else who has commented, thank you too! The logic in the if statements in the original code is correct.
I am going to try the simpler and prettier code written by Athanasius. BTW - I know the row count is correct because I looked at it in a few ways and checked a number of lines at the beginning, middle and end of several cut files against the original and these were right on. I will update the Monastery after I try the new code.
One last note - I mentioned I was working through the "Camel" book; well actually its the "Llama" book... sorry Perlers.