in reply to Re: How do I use stat
in thread How do I use stat

thanks for the tips. I'm new to PERL ( you could probably tell). That really got me off to a great start.........one more question though please. Aside from the code that you gave me, do I have to have anything else because i think that the (stat $_) is not actually working. Do I need to have any code before i make the if comparison?? Hopefully that makes sense Thanks a lot

Replies are listed 'Best First'.
Re: Re: Re: How do I use stat
by ducky (Scribe) on Sep 28, 2001 at 00:05 UTC

    No problem! That is exactly why we're here =)

    One thing to consider when doing stat is that it operates off of the current working directory. Perhaps $_ isn't really pointing to a valid file? Proper error checking is very good practice and often needs very little extra modification:

    die "Bigger problem: '$_' doesn't exist!" if not -e $_ ; if ( time - (stat $_)[9] > 1200 ) { print "ERROR MESSAGE" }
    Oh, and no, stat works just fine by its lonesome. No prep is needed.

    -Ducky