Todd W wrote:
"Brian Volk" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
After running a few tests... :~) I think I might be able to sort on the
inode... ? Does this make sense?
my @files = glob("/mnt/qdls/MSDSIN/*");
foreach my $file (@files) {
print "$file\n";
my $ino = (stat($file))[1];
print "ino is $ino\n";
Thanks!
Bob S gave you the answer. Change the line:
my @files = glob("/mnt/qdls/MSDSIN/*");
to:
my @files = map $_->[0],
sort { $b->[1] <=> $a->[1] }
map [ $_, -M ],
grep -f, # get only plain files
glob("/mnt/qdls/MSDSIN/*");
And you are all done.
Todd W.
Thank you to everyone for there responses... Great stuff! Of course I
have one more rookie question and a reference to a perldoc is just
fine. :~) If I use the following code, why do I not need to declare
the $a and the $b w/ my? I searched Google and found this " but rather
are handed to the subroutine as the values of the global variables |$a|
and |$b|." does this mean $a and $b are built in variables which I do
not need to declare?
Thanks again!
-------------------------
#!/usr/bin/perl
use strict;
use warnings;
my @files = glob("c:/brian/hp_work/text/*");
foreach my $file ( sort {(stat($b))[9] <=> (stat($a))[9]} @files)
{
print "$file\n";
}
--------------------------
Brian Volk
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>