Home: Perl Programming Help: Intermediate:
Removing a comma



yim11
Novice

Oct 26, 2000, 4:31 PM


Views: 673
Removing a comma

Hello,
I have a script that calcualtes how much time a workers makes while on break. The user enters their salary and amount of time on break and the script tell them how much they made while on break.
Well, I recently learned that if the user uses a comma when entering their salary the scripts wont calculate correctly.

My question is how can I remove that comma so the scripts functions as its supposed to.

TIA,
-Jim


perlkid
stranger

Oct 26, 2000, 6:13 PM


Views: 673
Re: Removing a comma

 
$salary =~ tr/,//;

Or

$salary =~ s/,//g;