#!/usr/bin/perl unlink "files/\d*"; mkdir(files,77777); system"lynx -source http://www.amoco.com/what_we_do/ss/msds > alist"; open(IN,"alist"); while() { unless(/\"(\d{3,12})/) {next;} $filenum=$1; print "filenum=$filenum\n"; open(FILE,">files/$filenum.html"); open(MSDS, "lynx -source http://www.amoco.com/what_we_do/ss/msds/$filenum.html|"); while() { if(/lynx/) { print "BAD FILE";close MSDS; open(MSDS, "lynx -source http://www.amoco.com/what_we_do/ss/msds/$filenum.html|"); next; } print FILE; if(/PRODUCT NAME/){print;} } close FILE; }