1. Try using code tags:
use strict;
use warnings;
use File::Find;
use File::stat;
my @results;
find(\&search, "c:/test");
sub search {
if ($_ =~ m/ACH/ ) {
push @ {$results[0]}, $_;
push @ {$results[1]}, stat($_)->mtime;
}
}
my @temp = reverse sort { $a->[0] cmp $a->[0]} @results;
foreach my $x (@temp){
#print $results . "\n";
print $x->[0] . "\t" . $x->1 . "\n";
}
In the sort you are comparing $a->[0] with $a->[0], should probably be:
my @temp = reverse sort { $a->[0] cmp $b->[0]} @results;
However I'm puzzled. You seem to be putting the mtime field into element 1, yet you are comparing element zero. Also, if you want to compare numbers then you should use <=> rather than cmp.