Hello all, I am receive the unintialized value in number lt (<) at error when running the below perl script. The error is indicated on line 34. The challenge I face is that this script was written by one person; modified by another and I am tasked to fix it. I am a beginner to perl scripting. From what I've read, the (<) needs to be initialized...???
The script is called to delete files from a directory beyond a certain date. #!\Perl\bin\perl -w # usage: DeleteFiles.pl <dir> <#days> #use strict; # sub recurse($) { sub recurse { # my($path) = @_; my($path) = $_[0]; my($days) = $_[1]; my($seconds) = $days*24*60*60; ## append a trailing / if it's not there $path .= '\\' if($path !~ /\/$/); print "Set to delete from ... $path\n"; ##$path = '\\Working_Temp\\'; ##print "Hard coded to delete from: $path\n"; ## print the directory being searched ##print $path,"\n"; open (MYFILE, '>>deletes.bat'); ## loop through the files contained in the directory for my $eachFile (glob($path.'*')) { ## if the file is a directory if( -d $eachFile) { ## pass the directory to the routine ( recursion ) print "recursing $eachFile\n"; recurse($eachFile, $days); } else { ## print the file ... tabbed for readability my $now = time; my @stat = stat("$eachFile"); if ($stat[9] < ($now - $seconds)) { #print "del $eachFile\n"; print MYFILE "del \"$eachFile\"\n"; unlink("$eachFile"); print "Done.\n"; } print "\t",$eachFile,"\n"; } } } ## initial call ... $ARGV[0] is the first command line argument recurse($ARGV[0], $ARGV[1]); #close (MYFILE); -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/