You can do it that way, but see lvalue considered harmful... for some reasons why it may be a bad idea.
Jeurd's Attribute::Property is worth investigating if you like the lvalue style. It resolves some of the problems of lvalue subs at the expense of some tied objects behind the scenes.
In reply to Re^2: Single accessor/mutator idiom in Perl5, Perl6 and Python
by adrianh
in thread Single accessor/mutator idiom in Perl5, Perl6 and Python
by adrianh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |