|
|
| The stupid question is the question not asked | |
| PerlMonks |
Re: Optimize file renaming.by halley (Prior) |
| on May 26, 2005 at 09:30 UTC ( [id://460674]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
So far, nobody's offered glob(), so I'll throw that in there. Unless you're expecting to load several thousand filenames every few seconds, avoid the extra hassle of a readdir() loop. Since you're not even trying to save memory in your code, you should see no obvious performance difference.
Replace:
With:
Many people work in the current directory, and specify specific wildcard masks. The "angle brackets" operator calls glob() for you (if it's not a bareword), so this might be even more readable. Oh, and there are a few cases where Windows still really requires backslashes, but most of the time, it accepts forward slashes, Unix-style. (This has been true since MS-DOS 2.0 when it introduced subdirectories.) I find them easier to type and read. --
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||