Actually, I did:
$ cat test.pl
#!/pro/bin/perl
use 5.016;
use warnings;
my $DIR = "usr";
opendir my $dh, $DIR or die "Error opening $DIR: $!";
my @files = sort { $b->[10] <=> $a->[10] }
map {[ $_, CORE::stat "$DIR/$_" ]}
grep !m/^\.\.?$/, readdir $dh;
closedir $dh;
use DP;DDumper $files[0];
$ ls -lrt usr
total 16
-rw-rw-rw- 1 merijn users 2588 Jun 18 2004 Honda.gif
-rw-rw-rw- 1 merijn users 2388 Feb 20 2007 Honda.png
-rw-rw-rw- 1 merijn users 3774 Feb 20 2007 Honda.ico
drwxrwxrwx 2 merijn users 4096 Oct 22 2012 terminfo
$ perl test.pl
[ 'terminfo',
2065,
15481507,
16895,
2,
203,
100,
0,
4096,
'1366762203',
'1350940900',
'1350940900',
4096,
8
]
$ touch usr/new
$ perl test.pl
[ 'new',
2065,
11278617,
33206,
1,
203,
100,
0,
0,
'1366816276',
'1366816276',
'1366816276',
4096,
0
]
$
Enjoy, Have FUN! H.Merijn
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.