Perl Topics





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Perl Tutorial
Introduction Introduction
Installing Perl Installing Perl
Basics of Perl Basics of Perl
Scalar Variables Scalar Variables
Operators Operators
Control Structures Control Structures
Lists Lists
Array Array
Arrays Manipulation Arrays Manipulation
Arrays Functons Array Functions
Hash Hash
Hash Functions Hash Functions
String Functions String Functions
Regular Expression Regular Expression
Regular Expression Functions Regular Expression Functions
Numerical Functions Numerical Functions
List Functions List Functions
User Defined Function User Defined Function
File Handling File Handling
Forums Ask Your Doubts
Feedback Feedback
 





Assignment Operator in Perl


Tutorials Perl

Topic

What are the Assignment Operator in perl?



Explanation
Operator Function
= Normal Assignment
+= Add and Assign
-= Subtract and Assign
*= Multiply and Assign
/= Divide and Assign
%= Modulus and Assign
**= Exponent and Assign

Everyone knows how to use the assignment operator (=). There are other operators, when used with "=" gives a different result.

Example:
    #! C:\programfiles\perl\bin\perl
    print "content-type: text/html\n\n";
    $a = 50;
    $a += 50;
    print "Value of a using addition operator: $a \n";
    print "<br>";
    $a %= 8;
    print "Value of a using modulus,assign operator: $a \n";
Result:
    Value of a using addition operator: 100
    Value of a using mod,assign operator: 4 

The above statement is equivalent to "$a=$a+50", thus displaying the result 100. In the same way, the working of modulus assignment operator is shown to display the remainder as "$a=$a%8" equal to 4.








A Note
Simple introduction, basic CGI perl programming codes with examples. Do send your feedback or suggestions on this tutorial. This is a copyright content.

Other Links

web hosting