|Perl: the Markov chain saw|
I apologise for having missed the OS info in your original post.
By unpacking the output you posted into a file and reading from that, I can reproduce your results.
However, if I open the resultant file and cut and paste the lines (which also fixes up the line endings) back into the __DATA__ section of my original program, it works as demonstrated.
My (tentative) conclusion is that the line-endings in the original file are screwed up. My evidence is that by using the -l switch on the one-liner above, any native line endings should have been stripped, but as you point out, the 0d's are still there. That suggests to me that when the file was moved from Win32 to unix, either the line endings weren't converted, or they were converted incorrectly.
As you can see from the od output, after reversing the packing process, the file ends up with line endings of x'0d0d0a', which I think indicates that there are dos-style line endings in the original file at your end, which perl-on-unix doesn't handle, and it is that that is causing the regexes to fail.
The answer (I think) to your problem would be to use the appropriate utility (or one of the perl one-liners kicking around this site) to convert the line endings on the file prior to running the script.
You could do it integrally to the script, but that would kind of negate the benefit of what I was originally trying to demonstrate, ie. that if you want to process 3 lines at a time, reading 3 lines on each iteration of the loop is much easier than having 3 cases within the loop.
Anyway, I hope this helps in some way, and hasn't completely wasted your time.
Examine what is said, not who speaks."Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail