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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regular Expression with negative number

Status
Not open for further replies.

wsexton

Technical User
Dec 4, 2001
49
0
0
US
I'm trying to remove a comma from a negative number:

First I use substr to get the number:

$number = substr($line, 1, 10);

Now $number has -1,125.50

I do this: $number =~ s/\,//g;

This works for a positive number, but not negative.

Any ideas?
 
I figured it out. Just a dumb mistake. Thanks anyways.
 
Can you post your fix, it might help others :)

Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top