in reply to www::mechanize file download script

If you want to get all of the pdf, zip, rar and chm files, you will have to change your regex. As it is now it will only grab some of the pdf files, namely those with one or more digits somewhere in the file-name, then something else and ending with '.pdf'.

To get all of the file types use (?:pdf|zip|rar|chm)$.

ALthough it is rare, nothing guarantees you that the pdf, zip, rar and chm files on the web-pages will have a pdf, zip, rar or chm extension anywhere in the url. HTTP being what it is, one can serve arbitrary files with an arbitrary URL. The only way to make sure is to follow every link, check what gets send back and hope they did not goof up the headers.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James