Description
Sort Words Line by Line
Write a Perl program sort_words.pl that reads lines of text from its standard input and prints them to its standard output with the words on each line rearranged to be in sorted (alphabetic) order.
You can assume that a word is any sequence of non-whitespace characters.
You should print the words separated by a single space character.
For example:
| $ ./sort_words.pl
I shall be telling this with a sigh Somewhere ages and ages hence Two roads diverged in a wood and I I took the one less traveled by And that has made all the difference Ctrl-D I a be shall sigh telling this with Somewhere ages ages and hence I Two a and diverged in roads wood I by less one the took traveled And all difference has made that the |
Your answer must be Perl only. You can not use other languages such as Shell, Python or C.
You may not run external programs, e.g. via system or backquotes.
You can assume your input is ASCII.
No error checking is necessary.




