Yoz's Original Collapsible Travelling Punctuation-In-Place-Alphabetiser (PIPA)

 

print grep(s/\w+([\.']\w+)*/shift(@w)/ge||$_,
grep(s/\w+([\.']\w+)*/(push(@w,$&),$&)[1]/ge||$_,
<>),do {@w=sort {lc($a) cmp lc($b)} @w;''});

That's all there is to it!

Why not take PIPA for a spin? Enter the text to be alphabetised -- the more the better:

 

 

Starship Titanic Home

 

©1997 The Digital Village Ltd/Simon & Schuster Interactive Inc. All Rights Reserved.