Why does // have lower precedence than == in (at least) perl 5.010?
For example, this
use 5.010;
my $may_be_undefined = 1;
my $is_equal_to_two = ($may_be_undefined//0 == 2);
say $is_equal_to_two;
prints (for me) very unexpected result.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s because of the category of operators which
//falls under, aswell as==.==is an “equality operator” though//falls under the category of “C-style logical operators“.As an example;
&&is in the same “category” as//, with that said both of the statements below are equivalent when it comes to operator precedence. That might make it easier to understand?Documentation of C-style Logical Defined-Or ( // )
Documentation of Operator Precedence and Associativity