Node:Auto-Increment and Decrement, Next:, Previous:Comparison Operators, Up:Operators



Auto-Increment and Decrement

The auto-increment and auto-decrement operators in Perl work almost identically to the corresponding operators in C, C++, or Java. Here are few examples:

     use strict;
     my $abc = 5;
     my $efg = $abc-- + 5;       # $abc is now 4, but $efg is 10
     my $hij = ++$efg - --$abc;  # $efg is 11, $abc is 3, $hij is 8