my @files = glob 'logfile_*.log.gz'; @files = reverse sort { -M $a <=> -M $b } @files.