use strict; use warnings; use LWP::Simple; use File::Compare; use File::Copy; $| = 1; sub main { #Create a file with current content, compare with all present files in directory if same, delete, if not, keep. unless(-e('filesaves') or mkdir('filesaves')) { die("Directory Couldn't Be Created.\n"); } #create directory if it does not already exist my $fileName; print("Enter Site Directory: "); #Test input: http://caveofprogramming.com #Gather site URL with directory my $siteDirectory = ; print("Number of Times to Run: "); #Test input: 10 my $runAmount = ; #Gather the number of times to check the web address unless(opendir(DIR, 'C:\\Program Files\\OSNE')) { die("Unable to open directory 'C:\\Program Files\\OSNE'\n"); } for(my $i = 0; $i <= $runAmount; $i++) { my $file = readdir(DIR); closedir(DIR); $file = grep(/\.txt$/i, $file); #Filter as to only look for .txt files my $searchTable = get($siteDirectory); #Get HTML code from website if(defined($searchTable)) { $fileName = localtime() . '.txt'; #Set file name to the time it will be created $fileName =~ s/:/-/g; #remove the disallowed characters and replace them so that it can be the file name open(my $outputFile, '>', $fileName) or die("Couldn't Create File.\n"); while($searchTable =~ m|<\s*a\s+[^>]*href\s*=\s*['"]([^>"']+)['"][^>]*>\s*([^<>]*)