in reply to split and tie::file

You need to use the verbatim package, something such as this:
#!/usr/bin/perl use strict; use warnings; use Tie::File; __END__ -- test -- [% USE Latex; out = FILTER latex(format="pdf"); -%] \usepackage{verbatim} \begin{comment} This is a comment Ditto Double-Ditto \end{comment} \documentationclass{article} \begin{document} \section{{Introduction} \end{document} [% END; -%] [% out | head(4) %] -- expect -- %PDF