use Sort::Key::Maker sort_len => sub { length } , qw(integer); my @unordered = (qw/very_long short/); my @ordered = sort_len @unordered;