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: 
Operator precedence in your example is

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

```

while what you want is:

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

```

or

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

```
It doesn't:

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

```