in reply to Re: decimal precision
in thread decimal precision

The @{[...]} trick is useful for interpolating the result of a chunk of code into a string.

No doubt a nice trick... but in this particular case, the conversion to string would happen implicitly, i.e. you could also do

($o *= $e) =~ /(0\.0*\d{0,5})/;

Yet another way would be to use bignum's accuracy option (which also does take care of the rounding)

use bignum accuracy => 5; my $e = 0.00141; my $o = 1; for (1 .. 10) { $o *= $e; print "$o\n"; } __END__ 0.0014100 0.0000019881 0.0000000028032 0.0000000000039525 0.0000000000000055730 0.0000000000000000078579 0.000000000000000000011080 0.000000000000000000000015623 0.000000000000000000000000022028 0.000000000000000000000000000031059

(see Math::BigInt and Math::BigFloat for details on rounding modes, accuracy, precision, etc.)