http://www.perlmonks.org?node_id=928950


in reply to Re^3: Words in Words
in thread Words in Words

Sorry, but only comparing words with those that come after it alphabetically doesn't work.

True, but in the solution I posted I sort by length after the alphabetical sort. The alphabetical sort is probably overkill but needed for this particular solution.

chomp (my @words = sort { length($a) <=> length($b) } sort <DATA>);