Here is what ls -l returns for one of my files:
-rw-r--r-- 1 jeffp dialup 1233 Jul 30 18:30 resume.txt
Breaking that into pieces, we have:
- file type and permissions
- number of links to file
- owner of file
- group of owner of file
- size in bytes
- last modified date
- name of file
All these -- except for the filename, which you already have -- can be extracted from stat():
use POSIX 'strftime';
my ($perm, $links, $uid, $gid, $size, $lmod) =
(stat $file)[2,3,4,5,7,9]
my $user = getpwuid($uid);
my $group = getgrgid($gid);
my $date = strftime("%b %e %R", localtime($lmod));
You actually need to modify that a tiny bit, in case the file was modified more than a year ago; but that's an academic exercise.
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??; |