in reply to Re: Re: Re: $var as accessor name?
in thread $var as accessor name?

That's not strictly true, though it is messy.

{ package test; sub new{ return bless [], $_[0]; } sub meth1{ print 'meth1'; } }; $t=test->new; $t->meth1; meth1 $h{x}='meth1'; $t->${ \$h{x} }; meth1

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: $var as accessor name?
by ysth (Canon) on Mar 12, 2004 at 07:33 UTC
    Shhh...the newbies are listening.

    More seriously, I very occasionally do that to interpolate an expression in a qq string where that makes the code clearer, but even if I did a lot more OO than I do, I don't think I'd ever do it for method names. It's so much clearer to use a temporary scalar. But I guess it depends on what you are used to seeing.