5.17. Your Salary is in Danger - Short-Circuit

If perl already knows the final value of a boolean expression after computing
only part of it, perl will NOT calculate the rest of the expression:

if ($my_money > 1_000_000 or $my_salary > 10_000) {
    # I can live well
}


if ($my_money > 1_000_000 or $my_salary++ > 10_000) {
    # I can live well
}

If you are interested in on-site trainings by the author, please contact me directly.

Online courses:

Would you like to get
updated when I publish
the next article?

Follow me:

Google Plus Twitter RSS feed