Check out example codes for "perl format decimal 2 places not rounding". It will help you in understanding the concepts better.

Code Example 1

my $places = 2;
my $factor = 10**$places;
int(1.555 * $factor) / $factor;  # 1.55

Learn ReactJs, React Native from akashmittal.com