|
|
Auto Increment or Decrement in Perl - Perl
|
Views : 191
|
|
Tagged in : Perl
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Auto Increment or Decrement in Perl
The ++ or -- symbols are used to increment or decrement a variable by one. Depending on whether the ++ or -- comes before or after the variable determines when it is incremented.
$d = 17;
$e = ++$d; # $e and $d both equal 18
$d = 17;
$e = $d++; # $e = 17 and $d = 18
$x = 12;
--$x; # $x = 11
$y = $x-- # $y = 11, $x = 10 |
|
By Geethalakshmi, On - 2010-09-17 |
|
|
|