in reply to Deleting files of a specific extension for dir

On Linux, you do not need perl:
find $dir -mtime +$age -name '*\.(gif|jpeg|pdf|doc)' -delete
There is a windows equivalent at http://unxutils.sourceforge.net/. However, as the esteemed corion has stated, File::Find::Rule will perform the same function.