I am trying to write a program
that will read a csv file from my bank
and sum up the money I spent during the month
the problem is some amount like "1,200.13", "1,105.02"
should add up to "2305.15", but instead
it's getting "2"!!!
I used an array to store the amounts like this
@ary = {"1,200.13", "1,105.02"}
an alternatives I came up with is like this:
Use Regular Expression to detect the ","
and then separate @ary to two :
@ary_basic = {"200.13", "105.02"}
@ary_1000 = {"1", "1"}
Then sum them up separately
But this solution only limits to amounts
that are less than 1 million.
Any better suggestions?
thx in advance :D
In reply to Regular Expression and digits problem(string, arithmetic) by tanyeun
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |