#!/usr/bin/perl
my ($x,$a)=(0,1);if ($a || $x++) {
print “foon”;
}
print “$x”;
At last, it will print 0 because, during the evaluation of if statement, since $a = 1, the next part of ‘or’ wont be evaluated. So $x will still remain 0.
When curiosity outbursts …!!!
#!/usr/bin/perl
my ($x,$a)=(0,1);if ($a || $x++) {
print “foon”;
}
print “$x”;
At last, it will print 0 because, during the evaluation of if statement, since $a = 1, the next part of ‘or’ wont be evaluated. So $x will still remain 0.