#!/opt/perl/bin/perl $centered=0; print "text\n"; while (<>) { if (/^\s{4,}/) { unless ($centered) { $centered=1; print "

\n"; } } else { if ($centered) { $centered=0; print "

\n"; } } if ($centered) { print "
\n";; } elsif (/^\s*$/) { print "

"; } elsif (/^\s+-/) { print "

"; } elsif (/^\s/) { #print "

"; # uncomment if you want separate paragraphs print "

"; # comment if you do not want indents } print; } print "\n";