[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] System in Perl
- Subject: [ale] System in Perl
- From: cfowler at outpostsentinel.com (Christopher Fowler)
- Date: Thu, 26 Jul 2007 23:58:49 -0400
Looks to me like you are trying to dimply display the last access time
of a file. I'm not sure what the problem of opening a file is but you
could actually use what you did.
Example:
[cfowler at shuttle ~]$ perl -MPOSIX -e '$a = (stat("/etc/inittab"))[8];
print POSIX::ctime($a);'
Wed Jul 11 17:54:16 2007
In my example stat() will return an epoch and you'll need to convert
that to a readable date.
my $access = `stat /etc/inittab | grep -i access | grep -v Uid | cut
-b8-27`;