You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by "Carter, Pamela A." <Pa...@bakeroiltools.com> on 2001/10/04 15:51:41 UTC
Formatting Variables in Perl
I am passing a variable that needs to be in currency format (with two
decimal places). It passes as a whole number with no decimal. How can I
format this?
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Formatting Variables in Perl
Posted by "Luiz Fernando B. Ribeiro" <li...@athome.pro.br>.
Hi Pamela,
Try this:
$value = 200;
$value_ok = sprintf("%.2f", $value);
print "R\$ $value_ok"; # gives R$ 200.00
Resposta a sua mensagem de quinta-feira, 4 de outubro de 2001:
CPA> I am passing a variable that needs to be in currency format (with two
CPA> decimal places). It passes as a whole number with no decimal. How can I
CPA> format this?
CPA> ---------------------------------------------------------------------
CPA> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
CPA> For additional commands, e-mail: embperl-help@perl.apache.org
Sem mais,
Luiz Fernando B. Ribeiro
Engenho Soluções para a Internet
engenho@athome.pro.br
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org