in reply to genarating latex using perl

Try specifying the full path of pdflatex to system.