our $template; &template_fun; $template =~ s/\#([^\#])\#/${$1}/ge; # see update note my $tmstamp = localtime; $tmstamp =~s/ |:|-/_/g; my $tmpfile = "D:\\pdfs\\" . $tmstamp . ".html"; open (HTMLFILE, ">$tmpfile") || die "cannot do it: $!"; print HTMLFILE "$template"; close(HTMLFILE); ## here's where we make the actual system call chdir "D:\\HTMLDOC\\"; system("htmldoc -t pdf --webpage -f D:\\pdfs\\" . $RGA_num . ".pdf $tmpfile"); unlink $tmpfile; sub template_fun(){ $template = '
|
#companyName#
|
||
RGA number: #RGA_num# (Write this number on the outside of your package) #raddress# |