On 3/27/07, Rodrigo Tavares <[EMAIL PROTECTED]> wrote:

What's the more fast ?

1) perl -pi -e 's/foo/bar/g' file.txt

2) open the file and make modifications

What happens when you time both programs? It may be that the answer
for me with my data on my hardware is different than the answer for
you with your data on your hardware.

If you're asking whether a Perl one-liner is slower or faster than the
equivalent program written out in a file, any difference in
performance should be insignificant under all normal circumstances.
One liners run at top speed, just as all other programs do.

If you're trying to optimize your algorithms, though, I'd expect that
the best answer depends upon the nature of your data, so be sure you
do tests with data similar to that you'll actually be using.

Good luck with it!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to