Rantanplan has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I am having a very strange problem with the combination of unlink and open:
my $myfile1 = 'D:\mypath\myfile1'; my $myfile2 = 'D:\mypath\myfile2'; use strict; use warnings; unlink $myfile1; my $myhandle; unlink $myfile2; open $myhandle, '>', $myfile2; close $myhandle;
As expected, myfile1 gets deleted.
As expected, myfile2 gets erased. It contains 0 Bytes.
However, the creation date and time of myfile2 does not get set to the time the script runs. The new myfile2 has the creation date and time of the old myfile2.
Why is this so?? And what can I do that the open command sets the creation date as expected to the time at which the command is executed at?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unlink+Open: File creation timestamp problem
by huck (Prior) on Feb 23, 2017 at 02:01 UTC | |
by NetWallah (Canon) on Feb 23, 2017 at 03:49 UTC | |
by Rantanplan (Novice) on Feb 24, 2017 at 09:49 UTC |