in reply to Weird ?: behavior
Damn, that was fast!
Thanks all!
I hadn't seen the assignment idiom before, it seems more operator-like and helps clear up the differnce between if and ?:. This use is subtly implied on p62 of Perl in a Nutshell when it says "the value of the evaluated expression becomes the value of the entire expression." I didn't see that I could use assignment as a consequence of this. Go figure.
Extra thanks to Tye for teasing apart the precedence issue. I pondered that one for a while but could not crack it. I just started adding parens until it worked!
PerlMonks kicks ass.
|
|---|