in reply to How to use the int-function?

int is actually doing what you expect; the issue is that finite decimals in general do not have a finite representation as a binary decimal - see What Every Computer Scientist Should Know About Floating-Point Arithmetic. While you can symbolically perform the operation in question, the actual representation is ever so slightly less than the exact answer. You don't see this with your print statement because perl runs the double precision value through an implicit sprintf to make the output pretty to a human. If we increase the precision on your output, we can see that the behavior makes sense:

#!/usr/bin/perl use strict; use warnings; my $i = 1.255; my $j = $i * 100 + 0.5; print "$j\n"; printf "%.16e\n", $j;

outputs

126 1.2599999999999999e+002

If your result is sufficiently sensitive that this is problematic, you can use Math::BigFloat, but this is likely a lot more complexity than a real world application requires.