powerhouse has asked for the wisdom of the Perl Monks concerning the following question:
I have tried all kinds of different variations. I cannot get this to work no matter what I try!# Tried this: $_table_data .= qq~ </td> <td align="center" valign="top" style="padding-top: 5px"> \$~ . sprintf("%.2f", "$_srp_price") . qq~ </td> </tr>~; # Result: .95 SHOULD be: 4.95 # And this: $_table_data .= qq~ </td> <td align="center" valign="top" style="padding-top: 5px"> ~ . '$' . sprintf("%.2f", "$_srp_price") . qq~ </td> </tr>~; # Result: .95 # And This: $_table_data .= "\$"; $_table_data .= sprintf("%.2f", "$_srp_price"); # Result: Same thing: .95 # And This: $_table_data .= '$'; $_table_data .= "$_srp_price"; # Result: Same thing: .95 # And This: $_table_data .= '\$'; $_table_data .= $_srp_price; # Result: .95 Same thing again. # And this: $_table_data .= '\\$'; $_table_data .= $_srp_price; # Result: \.95 # And this (works without the dollar sign $_table_data .= sprintf("%.2f", "$_srp_price"); # Result: 4.95
Any ideas?use CGI::Carp qw(fatalsToBrowser); use CGI qw(:standard :cgi-lib escapeHTML); use Mail::Sendmail; use Digest::MD5; use Crypt::CBC; use Crypt::Blowfish; use LWP::UserAgent; use Calendar::Simple; use OGC::Sid; use strict; use Time::Duration; use vars qw($cookie $sessid $sessref $page $loggedin $pgtitle $_title +%in $_pp_browser $reqdir $pg $_page_content $_dur_time); $_dur_time = time(); ReadParse(\%in);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Printing a dollar sign..
by davorg (Chancellor) on Aug 26, 2004 at 11:03 UTC | |
by powerhouse (Friar) on Aug 26, 2004 at 20:33 UTC | |
|
Re: Printing a dollar sign..
by tachyon (Chancellor) on Aug 26, 2004 at 10:52 UTC | |
by powerhouse (Friar) on Aug 26, 2004 at 20:48 UTC | |
by tachyon (Chancellor) on Aug 27, 2004 at 05:21 UTC | |
|
Re: Printing a dollar sign..
by borisz (Canon) on Aug 26, 2004 at 10:56 UTC |