[Melbourne-pm] Operator precedence to watch out for...

Mathew Robertson mathew.blair.robertson at gmail.com
Sun Mar 24 18:27:31 PDT 2013

I had a case where I was doing this:

  if ($x." ".$y =~ /something/) {

This was always evaluating to true - due to $x being true. ie: the
regex-match only ever applied to $y.

Looking up perlop, I was a little surprised to find that this regex
test-operator has higher precedence that other combining-operators.  ie:
compare with:

  $x + $y <= $z

Just something to watch out for.

Mathew Robertson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20130325/e2a8218c/attachment.html>

More information about the Melbourne-pm mailing list