Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Is there a way to get the datetime stamp of a file without adding extract modules to perl5

Replies are listed 'Best First'.
Re: File Datetime stamp
by DamnDirtyApe (Curate) on Aug 21, 2002 at 19:03 UTC

    The stat function should do the trick.

    my $ts = ( stat 'my_file.txt' )[9] ;

    _______________
    DamnDirtyApe
    Those who know that they are profound strive for clarity. Those who
    would like to seem profound to the crowd strive for obscurity.
                --Friedrich Nietzsche
Re: File Datetime stamp
by fglock (Vicar) on Aug 21, 2002 at 19:02 UTC

    Something like

    perl -e 'print localtime(time - 24*60*60*(-M "test.txt")).""'

    Substitute  -M if it is not exactly what you want

Re: File Datetime stamp
by LTjake (Prior) on Aug 21, 2002 at 18:54 UTC
    According to tye's wishes, I will just update this node.

    After writing a nice little paragraph on the -s file test operator and (stat $file)[7], i then realized that the topic was about date and not size (holy brain fart.)

    Anywho. I will have to agree with DamnDirtyApe's post and say that
    my $date = (stat $file)[9];
    is the best way. Also, here's a link to more information on the stat function. You can get information like size, modified date, uid, gid, mode, etc. of a file using that function.