if(expression1 or expression 2)
{
do something
}
If 'expression1' returns true, does the compiler starts to execute 'do something' or it evaluates the second expression too?
No, expression2
will not be evaluated if expression1
is true.
This is because or
is short-circutted in perl: once the result of the entire expression is known, evaluation stops. Evaluation occurs from left to right.