Operating and Assigning at Once : Assignment Operators « Language Basics « Perl






Operating and Assigning at Once

   

#!/usr/bin/perl

use warnings;
$a = 6 * 9;
print "Six nines are ", $a, "\n";
$a += 3;
print "Plus three is ", $a, "\n";
$a /= 3;
print "All over three is ", $a, "\n";
$a += 1;
print "Add one is ", $a, "\n";

   
    
    
  








Related examples in the same category

1.Using Assignment Operators on Scalar Variables
2.In Perl, an assignment itself can serve as an lvalue.
3.To set a variable, use the = operator.
4.Complex Assignment
5.Assignment Statements
6.Assign value to four variables
7.Basic Math Compound Assignment Statements
8.Compound Assignment Operators
9.Assignment Operators
10.The assignment operators.
11.Examples of assignment operators.
12.Compound operator