#!/usr/bin/env perl use strict; use warnings; use XML::Fast; use Template; my $xml = <<'XML'; 24 bachelors computers
23 ph.d. physics
XML my $xml_hash = xml2hash $xml; my $template = Template->new(); my $filename = 'output.tex'; $template->process(\*DATA, $xml_hash, $filename) || die "Template process failed: ", $template->error(), "\n"; system( "pdflatex $filename" ); __DATA__ \documentclass{article} \title{Roster} \author{pavani} \begin{document} \maketitle [% FOREACH st IN student %] Student [% st.number %] is a [% st.specialization %] [% st.degree %] student and his address is[%address%][%house_number%][%street name%]. [% END %] \end{document} #### student 24 is a computers student and his address is HASH(0x274b27c) student 23 is a computers student and his address is HASH(0x274b27c) #### student 24 is a computers student and his address is house_number="128"; street name="xxxx"; proddutoor. student 23 is a computers student and his address is house_number="12"; street name="xxxx"; kadapa. #### my $file; open($file, 'formal.xml'); my $xml=$file; my $xml_hash = xml2hash $xml;