[Melbourne-pm] Operator precedence to watch out for...
Brendon Oliver
brendon.oliver at gmail.com
Sun Mar 24 19:27:14 PDT 2013
On Mon, Mar 25, 2013 at 10:27 AM, Mathew Robertson
<mathew.blair.robertson at gmail.com> wrote:
> I had a case where I was doing this:
>
> if ($x." ".$y =~ /something/) {
> do_foo;
> }
>
> This was always evaluating to true - due to $x being true. ie: the
> regex-match only ever applied to $y.
>
Personally, I think I'd at least parenthesise the concatenation, if
not move it to a temp variable for the sake of clarity ;-) .... and
no "gotcha" that way.
cheers,
- b.
More information about the Melbourne-pm
mailing list