Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^3: Replacing Textby saintly (Scribe) |
on Apr 06, 2007 at 14:16 UTC ( [id://608681]=note: print w/replies, xml ) | Need Help?? |
Your solution is more easily maintainable and easy to understand, both admirable qualities and useful for production-level code. However, for a simple task like this that may be run only once, it may not be worth it to create a tool that does it. My first example would fit in with the script he already had to remove all the links in the file. An even simpler alternative is to just do the operation from the command line. No need to even open an editor. When I tested the above command line on a variety of web pages, it only missed one link: an href split across multiple lines (note: these are usually made by someone hand-coding HTML!). After fixing it by hand, the whole task was done. Remember that St. Wall has declared laziness to be one of the three great virtues of the programmer. Using the command line perl interpreter to get the job done is an even lazier way to solve the problem. I'm not claiming it's a better solution than yours, but it often helps to know several ways to solve the same problem so you can use the right tool for the job. Choosing the 'right' solution for even a simple task like this can take some consideration:
In Section
Seekers of Perl Wisdom
|
|