Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Removing comma's from int (numbers)

by choroba (Chancellor)
on Jun 12, 2013 at 22:16 UTC ( #1038604=note: print w/replies, xml ) Need Help??


in reply to Removing comma's from int (numbers)

You do not have to backslash a comma, it has no special meaning in a regexp. Also, you can fire the substitution right ahead without testing it will succeed - if it does not, nothing happens.
my $grossAmt = param("amt"); if ($grossAmt =~ s/,//g) { $grossAmt = sprintf '%.2f', $grossAmt; }

Are you sure you want to format the number only if commas were removed?

لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1038604]
help
Chatterbox?
[Lady_Aleena]: Module is currently 104 lines but will shirnk to 63. The script using the module is currently 40 lines but will grow to 82, 180 to 146 lines total. (This is after rewrting the data files.)

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2017-05-29 03:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?