Just my first perlgolf contest submission.
#!perl print join'',map{$^A=$v=$n=$l='';s/^\s+//;s/\s+/ /g;s/(?;