in reply to Sort by string length

You can give the sort function a custom sorting subroutine, using the special variables $a and $b. E.g.:

@sorted = sort { length $a <=> length $b } @elements

See also perldoc -q sort

Replies are listed 'Best First'.
Re^2: Sort by string length
by EchoAngel (Pilgrim) on Sep 03, 2004 at 22:06 UTC
    wow......that just blew my mind!