Table of Contents

Strings and Increments

$string="perl";
$num=20;
$mx=3;

print "The string is $string and the number is $num\n";

$num*=$mx;
$string++;
print "The string is $string and the number is $num\n";

Note the easy shortcut *= meaning 'multiply $num by $mx' or, $num=$num*$mx . Of course Perl supports the usual + - * / ** % operators. The last two are exponentiation (to the power of) and modulus (remainder of x divided by y). Also note the way you can increment a string ! Is this language flexible or what ?