in reply to one liner to print out sorted list of word

What you have would work if your pipe had sort and uniq in the other order:
perl -ne ... | sort | uniq
For that matter, you don't need uniq as a separate process:
perl -ne ... | sort -u
and of course, your perl one-line could do everything:
perl -ne 's/\W+/ /g; for $w (split){$u{$w}++} END{print join $/,sort k +eys %u,""}'
For that matter, you could also modify that slightly to print uniq words with their frequencies of occurrence (by including the values of %u along with the keys), which is also handy.