APM: Sorting the output of readdir in reverse order

Philip Molter hrunting at texas.net
Fri Nov 19 16:17:09 CST 2004


On Fri, 19 Nov 2004, Bakken, Tom - Temple, TX wrote:

: How would I sort the output of the readdir function in reverse order?
: 
: while (defined($File = readdir(DIR))) {
:   do something
: }
: 
: I've tried various things, all of them messy and failures.  

my @files = readdir(DIR);
foreach my $file ( sort { $b cmp $a } @files ) {
  do something
}



More information about the Austin mailing list