my @files = sort {(stat $a)[9] <=> (stat $b)[9]} glob "$mask*"; print $files[$position - 1], "\n";