in reply to Optimize file renaming.

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:

opendir(THISDIR,"e:\\perl\\comics\\"); my @comics=readdir(THISDIR); close(THISDIR);

With:

my @comics = glob('e:/perl/comics/*');

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.

my @comics = <*.png>;
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.

--
[ e d @ h a l l e y . c c ]