Final Solution
49 chars (53 if you include -nlp)
#!/usr/bin/perl -nlp
/
\.
/
;
@h{$_
,
"
$`
.M"
}
=
1
;}
$_
=
join
(
$\
,
sort
keys
%h
);{
horrible algorithm
join, sort, keys - too many chars
find a different way