You are falling prey to locale settings. You seem to have a German (or maybe other) locale where the decimal separator is "," (comma) not "." (dot). You will have to convert the data after you pull it out of Excel before you can work with it further:
use strict; use warnings; use Math::Round; my $rnd=Math::Round::Var->new (0.001); my $frsmt = $mtbf_data[3]; # use "$" instead of "@" if you only extrac +t one value of that row $frsmt =~ tr[.][]d; # eliminate all dots from the number $frsmt =~ tr[,][.]d; # turn all commas into dots $rounded_percent_frsmt=$rnd->round($frsmt); print "$rounded_precent_frsmt\n";
You should really, really get into the habit of using strict, because the code you posted didn't make much sense with the differing variable names ($frsmt vs. $precent_frsmt).
In reply to Re: argument isn't numeric in sprintf
by Corion
in thread argument isn't numeric in sprintf
by henrik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |