$bar = 7;
$foo =& $bar = 9;
From a technical stand point, wouldn’t this be evaluated from right to left?
So: $bar = 9; $foo =& $bar
In case anyone is wondering. The reason I’m doing this on one line is to avoid toe nail clippings.
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.
The assignment expression
$bar = 9doesn’t return a reference to$bar(i.e. the variable itself); instead, it returns the integer value9.Or if you need a quote from the manual:
You can’t assign a reference directly to a value, only to a variable that holds that value. So your handy one-liner fails spectacularly, and you’ll have to split it into two.