Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string formating help 1

Status
Not open for further replies.

quebasic2

Programmer
Dec 17, 2002
174
IN
I have a varible called $Red_Subtotal. The number can vary anywhere from 1 to in the thousands. How can I check to see if the number has two decimal places, if it does not, it will add .00 to the end of the string. It will not, however, change a number like $24.32. I also want my program to add a comma if the number is over 999. example:

Original number: 24
Output: 24.00

Original number: 2400
Output: 2,400.00

Original number: 24.43
Output: 24.43

Original number: 2400.25
Output: 2,400.25

Thanks in advance. I am converting a php form processor to perl, and I used to preform this task with the number_format command, but perl apparently does not a have a similar command. If there is one, please notify me.
 
Can someone please answer my question?
Also, I have a perl debugger that is really old, so that might be the problem, but it gives me an error when I use $variable = param('whatever'); . When was that command implemented?
 
If it is giving you a problem with unescaped @, then you can use JavaScript, or VBscript to escape it before submitting the form.

BTW - You haven't said it is giving you a problem. Sometimes the best way to check these things out is to suck it and see, rather than speculating about it.

Also it would appear that your original question was adequately answered, and that maybe you should consider posting a new question re the uescaped AT symbol.

A second question on your debugger issue might also be an idea, although as you have pointed out the debugger is quite old, maybe you should think about upgrading it, and see if that sorts out the problem.

It is safe to assume that there is a wealth of experience in this forum, but if you review a couple of the longer posts, you'll see that there is a certain etiquette to getting better results, and doing some of the investigative work, and demonstrating effort will encourage other posters to assist.

Hope that helps

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top