Hello everyone,


I'm fairly new to perl and recently signed up. I need help, below is my script which is working but i really need to change my code, as I don't want to use -M (match operator) and glob funtion in my code below.

Could you guys please correct my code below so I can use 'OPENDIR' function, instead of using 'glob' and also I want to use the "Time::Local" module...

All I want from code is to simply delete files older than seven days,...Please help as its urgent... Below is my code, please correct it. If you could please correct and send me the new code.
Thanks in Advance guys

#!/usr/bin/perl
foreach (glob("*")) { #instead of this I want to use OPENDIR funtion here#
print;
my $age = -M ; #I don't want to use -M operator to match..Please correct it#
my $logfile = "/var/spool/cleanlogs.out";
if ($age > 7) { #This statement will be changed once u correct it#

OPEN (STDOUT, ">>$logfile"); #I dont want to use 'STDOUT' to send the output to a file,so this has to be changed, please correct'#.

print " IS OVER 7 days old\n";
} else {
print " is ",int($age)," days old\n";
CLOSE (STDOUT);
}
}
#########################################################
I look forward to hearing from you soon.
Cheers,
Raf

_________________________________________________________________
New year, new job – there's more than 100,00 jobs at SEEK http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau&_t=752315885&_r=Jan05_tagline&_m=EXT

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to