programming-examples/perl/_Basics/Autoincrement and Autodecrement Operators and Assignment.pl
2019-11-15 12:59:38 +01:00

16 lines
297 B
Perl

#!/usr/bin/perl
$x=5; $y=0;
$y=++$x; # Add 1 to $x first; then assign to $y
print "Pre-increment:\n";
print "y is $y\n";
print "x is $x\n";
$x=5;
$y=0;
print "Post-increment:\n";
$y=$x++; # Assign value in $x to $y; then add 1 to $x
print "y is $y\n";
print "x is $x\n";