Hmm. That Perl doesn't work. I'm sure that was in my copy of Learning Perl, let me go look it up.
The book has a wholly different method?
Apparently Perl has changed since this book was published in 1991? Huh. How dare.
@mwl At one point I was very fluent in Perl 4 and stumbling through Perl 5 as it was being developed. Then I stopped doing much scripting for years in Perl moving to Python.
I had need of a quick script about two years back and the code that came out of my fingers simply didn't work. The language had changed too much. The only reason I didn't pick Python at the time was because, like most ugly reasons to use Perl, what I really wanted was PCRE and not to need sed.