Question: Here is the sample. For some strange reason Perl thinks that `1 and 0` is a true value. Why?

```
$ perl -e '$x = 1 and 0; print $x;'
1

```

Answer: 
Because the precedence of `and` and `&&` differ:

`$x = 1 and 0` is like `($x = 1) and 0`, whereas `$x = 1 && 0` is like `$x = (1 && 0)`.

See [perlop(1)](http://perldoc.perl.org/5.16.2/perlop.html#Operator-Precedence-and-Associativity).
It doesn't:

```
$ perl -e '$x = (1 and 0); print $x;'
0

```