char_perl has asked for the wisdom of the Perl Monks concerning the following question:
Below is my code to read the contents of this file
#!/bin/env perl use strict; use Spreadsheet::Read; use Spreadsheet::XLSX; my $lExcelFileData = ReadData("test.xlsx"); #Reading Price information from the input excel sheet using template i +nformation my $lRate = $lExcelFileData->[1]{A1}; print "Rate in xlsx file-> ".$lRate . "\n";
Output on which perl 5.8.8 is installed
bash-3.2$ ./print_xlsx_file_surya1.pl test.xlsx Rate in xlsx file-> 0.99
It is getting rounded to two decimals. Interesting thing is this 5.8.8 installataion is on sun solaris machine. Where as, I have run the same program in 5.8.9 installated Linux machine, It is giving me correct value as output .9888. The thing is for both installations, i have set the PERL5LIB to the same libraries. Not sure what is going wrong. Working in one environment and not working in other.
I need this without getting rounded. I also tried to print the content of same Read.pm in those two environments -
5.8.8 (sun solaris): bash-3.2$ ./print_xlsx_file_surya1.pl test.xlsx 8->sheet$VAR1 = 'maxcol'; $VAR2 = 1; $VAR3 = 'maxrow'; $VAR4 = 1; $VAR5 = 'A1'; $VAR6 = '0.99'; $VAR7 = 'label'; $VAR8 = 'Sheet1'; $VAR9 = 'attr'; $VAR10 = []; $VAR11 = 'cell'; $VAR12 = [ [], [ undef, '0.98880000000000001' ] ]; Rate in xlsx file-> 0.99
Our production box is sun solaris and i dont want rounding to happen. Please suggest.The same Read.pm is printing the below in linux version: :/cmpnt/slt1.0/devlp/SLTICT01/WORK/cmac6844>./print_xlsx_file_surya1.p +l test.xlsx 8->sheet$VAR1 = 'maxcol'; $VAR2 = 5; $VAR3 = 'maxrow'; $VAR4 = 6; $VAR5 = 'A1'; $VAR6 = '0.9888'; $VAR7 = 'E6'; $VAR8 = ''; $VAR9 = 'label'; $VAR10 = 'Sheet1'; $VAR11 = 'attr'; $VAR12 = []; $VAR13 = 'cell'; $VAR14 = [ [], [ undef, '0.9888' ], [], [], [], [ undef, undef, undef, undef, undef, undef, '' ] ]; Rate in xlsx file-> 0.9888
This problem is not coming with xls sheet. Only with xlsx am facing this.
|
|---|