[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] New user's first question on replacing html code



On Sun, Mar 05, 2000 at 12:27:14PM -0500, tech support wrote:
> I want to replace some html code in a whole bunch of files that are 
> located in nested folders (all within a root folder). The replacement 
> of the HTML code in the files is actually three different replacement 
> (where I replace the header, footer, and some more code inside the 
> file).
> 
> As someone who is about to start using Perl. How difficult is this to 
> do?

This should be very straightforward to do in Perl.  You can use the
File::Find module to handle finding the files, so all you need to write is
code to open a file, read it in, replace parts of it, and write it back
out.


> I want to compare this to Python which I will be evaluating VS 
> Perl. I will doing the replacement for about some 10,000 files, so 
> should efficiency be a consideration?

That depends how many times you need to do the replacement.  If you're
only ever going to use this script once, efficiency is not a big concern.
On the other hand, if you're going to use the script several times,
efficiency is important.


Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org