My question is: Who's trying to modify anything?$ perl -e 'tied( sub {}->() )' Can't modify non-lvalue subroutine call at -e line 1.
If I were reading this, my reaction would be “You tie variables, not values, so it doesn't make sense to test the result of a subroutine call using tied” (I tried it in a fit of optimism anyway); but my question is not so much why this approach doesn't work as why I get an error about an attempted modification when none exists. Is tied doing something bizarre internally like trying to assign to its argument and seeing if a STORE method fires?
(On a presumably much simpler note, I don't see why
parses differently. According to perlop, -> is higher in priority than anything but terms and list operators. As near as I can tell from perlfunc, tied isn't a list operator. I don't know if it's a ‘term’ because I'm not really sure what a ‘term’ is. :-)
UPDATE: As tye pointed out in the Chatterbox, perl -e 'tied sub {}->()' doesn't actually produce that error. It was all a dream!)
In reply to tied, or modified? by JadeNB
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |