Hi all,
(long, answer below)
I have this bit of code:
for my $file (@files) {
my @stat = (stat $file);
my $mtime = (stat $file)[9];
my $when = localtime $mtime;
print "$when: $file -- @stat\n";
}
And from my array of three files I get this as output:
sputnik:~/perl/learning_more_perl/06chap -> ./01ex-06chap
Use of uninitialized value in localtime at ./01ex-06chap line 47.
Thu Jan 1 01:00:00 1970: log-check_web --
Mon Jul 21 13:44:57 2003: 01ex-06chap~ -- 770 169066 33261 1 500 100 0 1069 1058787902
1058787897 1058787897 4096 8
Mon Jul 21 13:45:07 2003: 01ex-06chap -- 770 168406 33261 1 500 100 0 1068 1058787909
1058787907 1058787907 4096 8
But if I run stat on the CL I get:
File: `log-check_web'
Size: 26631 Blocks: 56 IO Block: 4096 Regular File
Device: 302h/770d Inode: 112617 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 500/pfeiffer) Gid: ( 100/ users)
Access: 2003-07-21 13:35:39.000000000 +0200
Modify: 2003-07-21 13:46:54.000000000 +0200
Change: 2003-07-21 13:46:54.000000000 +0200
What obvious (Aha!) thing am I missing?
[time passes]
Okay, I modified my stat line:
my @stat = (stat $file) or warn "Stat error ($file): $!\n";
And now I see a useful message:
Stat error (log-check_web): No such file or directory
Which leads me to realize that I am trying to stat a file that is
not in the CWD... (hmmm... I think I was warned about that, too.)
(Anyhow, question answered, but maybe someone else will find this useful)
-K
--
Kevin Pfeiffer
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]