Think about Loose Coupling | |
PerlMonks |
Re: inheritance turns back and bitesby dragonchild (Archbishop) |
on Mar 01, 2004 at 14:40 UTC ( [id://332926]=note: print w/replies, xml ) | Need Help?? |
For the specific question, a better option might be to use overload and do dispatch based on the value you get. Something like:
Now, personally, I would never overload + to act as string concatenation. Concatenation isn't commutative, which breaks the implicit contract most people have with addition. As well, how do you define multiplication for strings? ------
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
In Section
Seekers of Perl Wisdom
|
|