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