my $x = 0; print $x, $x++; # Print 10?? #### #!/usr/bin/perl use strict; my @PRINT_STACK; my $x = 0; push @PRINT_STACK, $x++; print "PRINT_STACK => ( ",@PRINT_STACK, " )\n"; push @PRINT_STACK, $x; print "PRINT_STACK =>( ",join(", ",@PRINT_STACK)," )\n"; print pop @PRINT_STACK; print pop @PRINT_STACK; exit(); #### my $x = 0; print $x,$x, $x++; # Print 110?? #### my $x = 0; print $x,$x++, $x++; # Print 210?? #### #!/usr/bin/perl use strict; my @PRINT_STACK; my @OP_STACK; my $x = 0; my $temp; #print $x,$x++,$x++; push @OP_STACK, $x++; # push the last $x++ to the operator stack (pushes 0) print "OP_STACK => ( ",@OP_STACK, " )\n"; push @OP_STACK, $x++; # push the next $x++ operator to the operator stack (pushes 1) print "OP_STACK => ( ",join(", ",@OP_STACK)," )\n"; # All Operations are over $temp = pop @OP_STACK; #pop The operator stack and push it to print stack (pops 1) push @PRINT_STACK, $temp; # pushes 1 print "PRINT_STACK => ( ",join(", ",@PRINT_STACK)," )\n"; $temp = pop @OP_STACK; #pop The operator stack and push it to print stack (pops 0) push @PRINT_STACK, $temp; #pushes 0 print "PRINT_STACK => ( ",join(", ",@PRINT_STACK)," )\n"; push @PRINT_STACK, $x; # push the first $x to the operator stack (pushes 2) print "PRINT_STACK => ( ",join(", ",@PRINT_STACK)," )\n"; print pop @PRINT_STACK; print pop @PRINT_STACK; print pop @PRINT_STACK; exit(); #### $x=0; &myprint($x, $x++); sub myprint{ print join ",",@_; }