【问题标题】:Unable to determine file creation time with perl on Windows/Cygwin无法在 Windows/Cygwin 上使用 perl 确定文件创建时间
【发布时间】:2013-04-13 18:50:04
【问题描述】:

我写这个是为了找出给定文件的文件创建时间:

#!/usr/bin/perl
use strict;
use warnings;

use File::stat;

open (my $fh, '<', "abc.txt") or die "$!";
my $t = (stat($fh))[9];
print $t;

但是,这不起作用,并给出:

Use of uninitialized value $t in print at ./tests.plx line 9.

谁能指出我在这里做错了什么?或者这不能在 Windows/Cygwin 上的 perl (5.14.2) 上完成,我必须选择一些替代方法?

提前致谢。

【问题讨论】:

标签: windows perl file cygwin


【解决方案1】:

来自File::statstat 将返回File::stat 对象。删除use File::stat;获取数组或使用my $t = stat($fh); print $t-&gt;atime;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-14
    • 1970-01-01
    • 2011-02-05
    • 1970-01-01
    • 1970-01-01
    • 2012-03-12
    • 2016-01-02
    • 1970-01-01
    相关资源
    最近更新 更多