in reply to stat times
Your problem's pretty clear, actually - you're overwriting $_ in your loop there, and trying to stat the results anyway.
My recommendation is to stat once and store it in an array, like below, not only so you don't have that problem, but because it's more efficient - only one stat call.
Of course, there are better ways to do what you're doing, like Shendal's suggestion, but I figured you'd like to know what you did wrong.
for(@files) { my @stat = stat($_); print "$_\n"; $_ = $lastaccess = localtime ( $stat[8] ); #print "$_\n"; $_ = localtime ( $stat[9] ); print "$_\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: stat times
by GhodMode (Pilgrim) on Aug 12, 2002 at 18:45 UTC |