How to Keep Trailing 0 in Outuput

"Wei, Alice Ju-Hsuan" <[email protected]> Mon, 8 Aug 2011 14:38:42 +0000
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <[email protected]>
--===============1947656653044638600==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_E5BA3258E619034F87A4F74DCF9A3F7667FB60IUMSSGMBX104adsiu_"

--_000_E5BA3258E619034F87A4F74DCF9A3F7667FB60IUMSSGMBX104adsiu_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,

  Tried to create the output so that it preserves the trailing 0s when I pr=
int the result out. It looks like that my perl does just as that.

  $value=3Dsprintf("%0.2f", $value);
 Print_log $value. "\n";

However, when I tried to get that to print using the html template, which i=
s currently set to an XML format, the trailing 0 that were in the value fro=
m the log files disappeared.
Here is the output of what is in the log file
150766.81
84735.48
3704.94
3084.17
7715.67
4435.80

The first 5 displayed as it is above, but the 6th one was displayed as 4435=
.8. How can I keep the print out as it is on html-plate? Here is what I hav=
e in the html-template call:

my $main_tmpl  =3D HTML::Template->new(filename =3D> 'xml_generate.xml');
   # Find all parms in the template file and fill them with matching global=
 parm values
   my @parameter_names =3D $main_tmpl->param();
       $main_tmpl->param( total =3D> $total; );

Thanks for your help.

Alice


--_000_E5BA3258E619034F87A4F74DCF9A3F7667FB60IUMSSGMBX104adsiu_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri","sans-serif";}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-US" link=3D"blue" vlink=3D"purple">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">Hi, <o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">&nbsp; Tried to create the output so that it preserv=
es the trailing 0s when I print the result out. It looks like that my perl =
does just as that.
<o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;<o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;&nbsp;$value=3Dsprintf(&quot;%0.2f&quot;, $val=
ue);<o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;Print_log $value. &#8220;\n&#8221;;<o:p></o:p>=
</p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">However, when I tried to get that to print using the=
 html template, which is currently set to an XML format, the trailing 0 tha=
t were in the value from the log files disappeared.
<o:p></o:p></p>
<p class=3D"MsoNormal">Here is the output of what is in the log file<o:p></=
o:p></p>
<p class=3D"MsoNormal"><o:p></o:p></p>
<p class=3D"MsoNormal">150766.81<o:p></o:p></p>
<p class=3D"MsoNormal">84735.48<o:p></o:p></p>
<p class=3D"MsoNormal">3704.94<o:p></o:p></p>
<p class=3D"MsoNormal">3084.17<o:p></o:p></p>
<p class=3D"MsoNormal">7715.67<o:p></o:p></p>
<p class=3D"MsoNormal">4435.80<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">The first 5 displayed as it is above, but the 6<sup>=
th</sup> one was displayed as 4435.8. How can I keep the print out as it is=
 on html-plate? Here is what I have in the html-template call:<o:p></o:p></=
p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">my $main_tmpl&nbsp; =3D HTML::Template-&gt;new(filen=
ame =3D&gt; &#8216;xml_generate.xml');<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;&nbsp;&nbsp;# Find all parms in the template f=
ile and fill them with matching global parm values<o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;&nbsp; my @parameter_names =3D $main_tmpl-&gt;=
param();&nbsp;&nbsp; <o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$main_tmpl=
-&gt;param( total =3D&gt; $total; );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o=
:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Thanks for your help.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Alice<o:p></o:p></p>
<p class=3D"MsoNormal">&nbsp;&nbsp;&nbsp; <o:p></o:p></p>
</div>
</body>
</html>

--_000_E5BA3258E619034F87A4F74DCF9A3F7667FB60IUMSSGMBX104adsiu_--


--===============1947656653044638600==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
--===============1947656653044638600==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Html-template-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/html-template-users

--===============1947656653044638600==--