in reply to Re: Perl and common subexpressions
in thread Perl and common subexpressions

It's trivial to tell the difference between a method call and a hash lookup for the perl compile -- you're just having issues with C vs perl syntax. (Getting e, an element of the struct pointed to by p in C is p->e, which looks a lot like calling a method, m, on an object $o in Perl -- $o->m)

On the other hand, when it /is/ a method call, perl can't tell /what/ method is being called, because it doesn't know the type of the object you're calling the method on until runtime. The m method on Foo::Bar might be side-effect free, while the m method on Baz has side-effects.


Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).