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

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



>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? 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?

I'm assuming you are doing this on a Mac, given the forum.

I use Perl and Python interchangeably on Linux, but on a Mac use 
MacPerl pretty exclusively.  I think the reasons for this are:
1) The MacPerl application is wonderfully convenient to use 
interactively to develop smallish programs or to test snippets of 
code to make sure they do what you expect.
2) I tend to use Perl for short, small projects and Python for larger 
projects, and I am more likely to do the larger projects under Linux.

I've used Python on a Mac, and it is solid and good, but somehow it 
doesn't feel very "Mac-like", and lacks the nice set of Mac 
conveniences that MacPerl has (simple filehandling and dialogues on 
the one hand and fairly complete if complex support for most of the 
Mac toolbox on the other).

Based on this experience, I would say that both Perl and Python are 
excellent choices for the problem you have described, and I think its 
solution will be pretty easy in either case.  (Python 1.5 is much 
nicer than 1.4 for this problem as there was a huge improvement in 
regular expressions between 1.4 and 1.5.)  If this is likely to be a 
small program that only you will use, I think development will be 
easier in Perl.  If the whole thing is going to live on a Mac, I 
suspect that Perl is the better choice in any case.  If you were 
building a package that other people would use and it was going to 
live on a Unix-family machine, I'd consider Python.  MacPython is 
solid enough and portable enough that the initial development of that 
package could be done on a Mac.

I'm not enough of an expert to comment definitively on the efficiency 
question.  I do know that the experts argue about this alot, and the 
impression I take away from these arguments is that a program written 
in Perl is very likely to be efficient, but in Python, it is possible 
to write a slow program if you are not an expert.  It is also my 
impression that it is more difficult to efficiently handle a lot of 
files on a Mac than it is on a Unix-family machine; I'd suggest 
reading the archives of this and related groups for some good 
suggestions.

-David Steffen-
David Steffen, Ph.D.
President, Biomedical Computing, Inc. <http://www.biomedcomp.com/>
Phone: (713) 610-9770 FAX: (713) 610-9769 E-mail: steffen@biomedcomp.com

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