in reply to A little help w/ stat() por favor...

Since stat returns a list, you need to pick which element of that list interests you... Examining the stat man page shows mtime at index number 9. So, you might try:

$mtime = stat($files)[9];

$mtime = (stat($files))[9];
Or, if you'd like a relative "time since" in fractional days, you could use:
$days_since_modified = -M $files;
Update: /me ducks to avoid the flying trout and fixes the syntax error

-Blake

Replies are listed 'Best First'.
Re: Re: A little help w/ stat() por favor...
by augamecock (Novice) on Jan 11, 2002 at 06:42 UTC
    Thanks for the fast reply. When I tried

    $mtime = stat($files)[9];

    I got syntax errors and it wouldn't work.

    $mtime = -M $files;

    printed out 1's next to each file.

    Any other suggestions?
      Oops, sorry... that should have been:
      $mtime = (stat($files))[9];

      -Blake

        Thanks again Blake.. Still just giving me 1's. I tried
        $size = (stat($files))[7];
        because i definetly know the size of the file and it still gave me 1's. I dont get this. I thought this would be something pretty easy for me to figure out.
        Still giving me 1's. I tried with $size and $uid. All give me just the number 1
Re: Re: A little help w/ stat() por favor...
by augamecock (Novice) on Jan 11, 2002 at 06:57 UTC
    This is in response to the correction. I am still just getting the number 1 with any of the 13 elements that I try