#get the data first $a = ; chomp $a; $b = ; chomp $b; open TEX, ">file.tex" or die "Could not open file.tex"; print TEX <<'_END'; \documentclass{article} \begin{document} \title{TeX-report} \author{Me} \maketitle \section{Some data} _END print TEX "I have $a and $b. That's all for now.\n"; print TEX <<'_END'; \section{Some table} \begin{table} \caption{A table} \begin[|l|c|c|]{tabular} \hline _END while(){ chomp; print TEX join('&', split ).'\\ \hline'."\n"; } print TEX <<'_END'; \end{tabular} \end{table} \end{document} _END system("latex file.tex"); system("latex file.tex"); system("dvipdf file") if -e "file.dvi"; __DATA__ 129873 12315 1 8 2 1 3 100 8 3 4