The problem: bad performance

examples/advanced/sort_files.pl
#!/usr/bin/perl
use strict;
use warnings;


my @files = glob "*.xml";

my @sorted_files = sort { -s $a <=> -s $b } @files;

print "@sorted_files\n";