Graeme McLaren wrote: > Hi there, I decided that it would be a good idea to 'touch' the file > immediately after creating it and changing the modified date to the > current date, however its just not working for me. > > > change file permissions and 'touch' the file: > > system("chmod 777 "filepath/filename");
Try using the built-in chmod function: chmod 0777 'filepath/filename' or die "Cannot chmod 'filepath/filename' $!"; > system(touch -m "filepath/filename"); Try using the built-in utime function: utime +(stat 'filepath/filename')[8], time, 'filepath/filename' or die "Cannot utime 'filepath/filename' $!"; > attempt to read back the new modified date. > > open(HANDLE, $FILE); You should *ALWAYS* verify that the file opened correctly. open HANDLE, '<', $FILE or die "Cannot open $FILE: $!"; > my $date_modified = localtime( (stat HANDLE)[9] ); You don't need a filehandle for stat(), you could use the file name. stat $FILE or die "Cannot stat $FILE: $!"; my $date_modified = localtime( (stat _)[9] ); > Any ideas why this isn't working? Perhaps you couldn't open the file for some reason and used an invalid filehandle. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>