True Expressions vs. False Expressions

Contents | Up | Prev | Next

# 7.4. True Expressions vs. False Expressions

In Perl every expression is considered true except for the following three cases:

1. The number `0`.
2. The empty string (`""`).
3. A special value called `undef`. This is the default value of every variable that was not initialized before it was accessed.

One of the most convenient ways of cancelling code is to wrap it in an `if (0) { ... }` block. It usually is faster than adding comments to the beginning of each line. Of course, you should not distribute code that way, but it is useful for testing conjectures.

Contents | Up | Prev | Next