Whitespace elimination
(82 strokes) Finally, eliminate all whitespace, and move END to the beginning to avoid needing a semicolon.
#!perl -lp sub p{$D||print"$P.M"}END{$.&&p}/$P/ or$D=!p;/\./;$O=$`;$D+=/M$/||p if/[M-Z]$/