in reply to Delete Files

Your use of chomp is unnecessary. Read perldoc -f chomp, as it applies to stripping line endings from text files. readdir() doesn't return files names with a CR/LF on the end.

Your use of stat() is also unnecessary. You aren't capturing it's return value

To clarify the previous response:

if (-f $filepath) says "if $filepath is a file then do everything in the following block of code"

You probably want:

if (-f $filepath && (-M $filepath > $daysToPurge))
Which says "if $filepath is a file AND it's mod time is more than 3 days agao . . ."

Can't say why it worked on the first machine. It shouldn't have.

And just a tidbit that you might find helpful. It has nothing to do with perl but applies to the art of SysAdmin.

Naming files as somefile-2003-Jan... isn't going to sort nicely when you do a DIR command or view the directory in explorer. That's because $somefile-2003-Feb.. will appear before the Jan file, etc. It's better to use numeric months for that reason. Perhaps I'm just anal. . .