#!/usr/bin/perl -w use strict; use Benchmark; timethese(100, { 'chad' => \&chad, 'swartz' => \&st,}); sub chad { sort{ (-M $b) <=> (-M $a) } glob("*"); } sub st { map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [$_, -M] } glob('*'); } #### Benchmark: timing 100 iterations of chad, swartz... chad: 118 wallclock secs (56.91 usr + 47.25 sys = 104.16 CPU) @ 0.96/s (n=100) swartz: 1515 wallclock secs (142.33 usr + 1044.36 sys = 1186.69 CPU) @ 0.08/s (n=100)