You can create a custom sort routine by providing a sub of your own. See sort.
@sorted = sort { length($a) <=> length($b) } @elements;
HTH
Update: I see I don't type quite as quickly as kesterkester or Enlil... see Re: Sort by string length.In reply to Re: Sort by string length
by bobf
in thread Sort by string length
by EchoAngel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |