I left Perl a long time ago and lately have been using Python almost exclusively. That said, statements like this:
> insert the same bug into the X programs.
raise an eyebrow. In my experience the platform and language determine what the what the bugs will be. Said more simply: You aren't going to have the same bugs in Perl that you will in Python, and vice versa. Certainly you could, but typically you won't.
Also, the biggest problem with Perl isn't the language per se, it is the entrenched culture which is inclined to abuse of power and unclear coding, often in the name of "efficiency".
Still, Python drives me nuts daily with small things. I can't think of a language or platform that doesn't. Better yes, but not at a level to pick on Perl.
Oh, and I'm rusty but I'm pretty sure that regex is wrong.
I think you are right about there being an error. I didn't try running the code but it looks like it would match everything inside the html comment braces, but incorrectly stop at any occurrence of '-' instead of stopping matching only at '-->' which I assume is what is actually desired there.
So it should be /(.X?<!--)(..X?)-->(.X$)/ instead.
(Note I am using X as asterix because HN at the time of this writing converts asterisks to italics tags.)
But other than that the Perl is perfectly fine. And it is easily readable if you know Perl.
> insert the same bug into the X programs.
raise an eyebrow. In my experience the platform and language determine what the what the bugs will be. Said more simply: You aren't going to have the same bugs in Perl that you will in Python, and vice versa. Certainly you could, but typically you won't.
Also, the biggest problem with Perl isn't the language per se, it is the entrenched culture which is inclined to abuse of power and unclear coding, often in the name of "efficiency".
Still, Python drives me nuts daily with small things. I can't think of a language or platform that doesn't. Better yes, but not at a level to pick on Perl.
Oh, and I'm rusty but I'm pretty sure that regex is wrong.