programming-examples/perl/_Basics/Basic Math Compound Assignment Statements.pl
2019-11-15 12:59:38 +01:00

25 lines
565 B
Perl

#! /usr/local/bin/perl
$a = 5;
print "\$a equals $a before the operation.\n ";
$a += 4.2;
print "The result of \$a += 4.2 is $a \n";
print "\$a equals $a before the operation.\n ";
$a -= 4.2;
print "The result of \$a -= 4.2 is $a \n";
print "\$a equals $a before the operation.\n ";
$a *= 4.2;
print "The result of \$a *= 4.2 is $a \n";
print "\$a equals $a before the operation.\n ";
$a /= 6;
print "The result of \$a /= 6 is $a \n";
print "\$a equals $a before the operation.\n ";
$a %= 6;
print "The result of \$a %= 6 is $a \n";