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.
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.