As was stated above, you're having problems with operator precedence. Consider the following two one-liners:
in reply to Or Operator
You may have to change the single-quotes to double-quotes to get the above examples to run from the command line, depending on what platform you're on
perl -le '$a = undef or 1; print $a'
perl -le '$a = undef || 1; print $a'
As perlop tells us, 'or' has lower precedence than '=', while '||' has higher precedence than '='. So the first one-liner is equivalent to:
whereas the second one is equivalent to:
perl -le '($a = undef) or "foo"; print $a'
perl -le '$a = (undef or "foo"); print $a'
Feel the white light, the light within
Be your own disciple, fan the sparks of will
With all of us waiting, your kingdom will come