http://qs1969.pair.com?node_id=1193573


in reply to Issue getting value from text file and keep decimal

UPDATE2: You were close. You want to set the decimal places to 2 values before you add commas. See also Number::Format. This works for me:
$format_main_balance = format_value(sprintf("%.2f",$main_balance +));

UPDATE1: I just read-read your question, and I now see the decimal dropped for 900,000.

OLD... IGNORE: When I run your code, it seems to keep decimals. Here is the output I get:

DATE DESCRIPTION DEBIT CRED +IT BALANCE ====================================================================== +================== 2017-05-01 starting balance to track character cou~ 900, +000.00 900,000 2017-05-01 phone bill dsfsdfsfdsfsfsfsdfsfsfsfsfdf~ 300,000.00 + 600,000 2017-05-03 Water 100,000.34 + 499,999.66 2017-05-05 Electric Bill 900.21 + 499,099.45 2017-06-03 debit 45678901dfsf2345678901234567890dd~ 30.32 + 499,069.13 2017-06-03 12345678901234567890123456789034 + 30.98 499,100.11 2017-06-03 credit 89012345678901234567890345678901~ + 30.98 499,131.09 2017-06-03 credit dfdfd012345678901234567890345678~ + 30.98 499,162.07 2017-06-08 Food 23.00 + 499,139.07 2017-06-12 Cash 20.00 + 499,119.07

Do you get a different output? If so, post exactly what you get. I'm using Perl version 5.16.3.

Basic debugging checklist