in reply to recurse directory script
++tamills and ++LordAvatar for their helpful tips. In particular, tamills's advice should produce a massive performance boost, because in your code, @files = (@files,$_); is essentially replacing the entire contents of @files with its prior contents plus a new element, EVERY TIME you add to it.
The time it takes to add a new element this way increases exponentially with the number of elements in the array, versus push which runs in approximately constant time.
Mustn't forget the, ahem, obligatory standard advice:
As a rule, put -w on your shebang line, and use strict;, and take the time to remove any errors or warnings reported.
#!/usr/bin/perl -w use strict; use File::Recurse; # ...
BTW, subroutine calls no longer require the & prefix character. Using them makes your code unnecessarily more difficult to read.
Update: fiddled with text.
dmm
You can give a man a fish and feed him for a day ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re(2): recurse directory script
by FoxtrotUniform (Prior) on Jan 10, 2002 at 04:24 UTC | |
by tilly (Archbishop) on Jan 10, 2002 at 07:24 UTC |