When you print the localtime() function, the output is converted to a string scalar first, which is the in the standard format "Day Mon dd hh:mm::ss Year". To get the output you want, you should use the output as an array. See the documentation for the localtime() function for more info:
use strict;
use File::Find;
my $start = '/directory/path/dir';
find(\&process, $start);
sub process
{
return unless /\.html?$/;
print "HTML: $File::Find::name\t\t";
my $mtime = (stat($_))[9];
my @timevars = localtime($mtime);
my @months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov D
+ec );
return unless (
(($timevars[5]+1900) < 2000) || ( #less than 2000 or
(($timevars[5]+1900) == 2000) && #year is 2000
($timevars[4] == 0) && # month is Jan
($timevars[3] == 1) ) # Day is 1
);
printf(
"%s %02u %04u\n",
$months[$timevars[4]],
$timevars[3],
$timevars[5]+1900,
);
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.