This is by no means perfect, but it's a step up from your
original code.
#!/usr/bin/perl -T
use strict;
use warnings;
use CGI qw(:standard);
print header,
start_html('PM Poster'),
start_form,
textarea('post',undef,8,30),
submit('go'),
end_form,
;
if (param('go')) {
for (split /\s*\n(?:\s*\n)(?!.*\n*<\/code>)+/, param('post')) {
$_ =~ s/<(\/?)code>/<$1tt><$1pre>/g;
print p($_),"\n";
}
}
print end_html;
__END__
lines of source: 29 (including __END__ block)
empty lines: 5
commenting (shebang to be considered code): 6
lines containing only "}" or ";": 3
lines of code: 10 (first print is really only 1 line)
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)
|