in reply to Sort directory by file size

This sorts all files in the current directory by size:
use warnings; use strict; use File::Slurp qw(read_dir); my @files = sort { -s $a <=> -s $b } grep { -f } read_dir('./');

It filters out directories (even . and ..). I'm not sure why you are getting that warning.