What's the best way to get a file's modification date in DDMMYY format in Perl?
(Originally the question was "How to do it without the DateTime module". I removed this restriction in order to make the question more general.)
If this is the only date formatting I need to do and don't need any date features for anything else, I just use POSIX (which comes with Perl):
use POSIX; my $file = "/etc/passwd"; my $date = POSIX::strftime( "%d%m%y", localtime( ( stat $file ) ) );
-M if you aren't using relative time. Go directly to
stat to get the epoch time.