in reply to bad results from stat()

Are you sure that $size and $mtime aren't the device number and inode of the files?

perldoc -f stat

says it returns an array consisting of a lot more than size and mtime. If you want just those two attributes, I'd do
my @statinfo = stat($filename); my $size = $statinfo[7]; my $mtime = $statinfo[9];
perldoc -f stat for more info. Hope this helps.
--
jpg

Replies are listed 'Best First'.
Re^2: bad results from stat()
by snorky (Initiate) on Mar 08, 2005 at 00:06 UTC
    I have 3 books on Perl (but not the Camel book). They all dance around the important part of the topic. Now I understand what's going on (thanks to all of you who answered). So the part about stat() returning an array, and specifying which elements from the array I need to call, makes perfectly good sense. Thanks, Monks PS: I don't have the Camel book because 1. a former employer has it (grrrr) 2. I only use PERL when the task needs PERL's awesome power.
      We understand ;)

      By the way, perldoc is perl's online help and is installed with perl. It's a fantastic reference and easy to use. At a command prompt type:

      perldoc -f stat or any function name for info about the function and what args it expects and what it returns,
      perldoc perlop to decipher all of those funky operators,
      perldoc perlsyn
      perldoc perlref
      perldoc perlfaq
      are all worth looking at as well.
        Also
        • perldoc perlintro
        or even
        • perldoc perl