Bootstrap FreeKB - Perl (Scripting) - Multiplication (*)
Perl (Scripting) - Multiplication (*)

Updated:   |  Perl (Scripting) articles

This will print 10.

my $sum = 5 * 2;
print "$sum \n";

 

This will print "7.14".

my $sum = 5.1 * 1.4;
print "$sum \n";

 

This will round the result to a whole number.

use integer;
my $sum = 5.1 * 1.4;
print "$sum \n";

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 189fde in the box below so that we can be sure you are a human.