I wrote this piece of code recently. I don’t know why, but I’m terribly proud of it. Nobody here will understand it. That’s OK. I just need to show off for myself sometimes:

opendir(DIR, $backup_directory);
my @sorted_backups = sort {
($m{$a} ||= -M $a) <=>
($m{$b} ||= -M $b) }
map {$rep_directory . "\\" . $_ }
grep { /.ZP$/ } readdir(DIR);
closedir (DIR);

It was originally written as three distinct chunks of code, but I felt like obfuscating and combining things just a bit. And, yes, there are comments explaining this thing in the code, itself. In the end, it makes for a nifty subroutine, too. (A “subroutine” is what you Java folks like to incessantly call “methods.”)

I could also skip the whole “map” line if I just changed directories before that section of code started.

Now, maybe I’ll go work up a full-bore Schartzian Transformation for kicks. . .