in reply to An imperfect pattern matcher writer

You might consider replacing the multiple print statements with a heredoc or two. It'll cut down on the backwhacking you've got to do. Or use qq{} rather than ""'s for strings that need to be interpolated which include double quotes.

... print FILE_OUT <<'EOT'; $seq =~ /ZZZ/) { $match = $&; EOT print FILE_OUT qq{ \$name = "$name";\n}; print FILE_OUT <<'EOT'; $matchlength = length( $match ); $firstpos = index( $seq, $match ); print "$name, $match, $matchlength, $firstpos\n"; print "Got it!\n"; } elsif { EOT ...