FreeKB - Perl Subtraction (-)
Perl - Subtraction (-)

This will print "4.85".

print 5.1 - 1.4;


-= can be used to subtract from an already set variable. In this example, $i will equal 1.

$i = 3;
$i -= 2;

print $i;


This will round the result to a whole number.

use integer;
print 5.1 - 1.4;


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

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


Web design by yours truely - me, myself, and I   |   |