optimize::int - Turn on integer ops for specified variables
use optimize; my $int : optimize(int); $int = 1.5; $int += 1; if($int == 2) { print "$int is integerized" }
Most perl operators can be turned into integer versions which do all work in integers and truncates (floors) all fractional portions. This is traditionally done by use integer; which turns on integer operations in the scope. This is usually by far too wide area to turn on those ops in.
use integer;
For greater flexibility this allows you to turn on integer ops for a specific variable using the optimize attribute with an int argument, my $int : optimize(int);.
my $int : optimize(int);
Artur Bergman <abergman@cpan.org>
optimize integer
To install optimize, copy and paste the appropriate command in to your terminal.
cpanm
cpanm optimize
CPAN shell
perl -MCPAN -e shell install optimize
For more information on module installation, please visit the detailed CPAN module installation guide.