Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Using overload to parse arithmetic termsby esskar (Deacon) |
on Feb 07, 2006 at 12:01 UTC ( [id://528475]=perlquestion: print w/replies, xml ) | Need Help?? |
esskar has asked for the wisdom of the Perl Monks concerning the following question:
hi, i wrote a package Foo::Expression::Arithmetic, a package Foo::Number and a package Foo::Variable. I used overload to be able to do the following: $c1 and $c2 are now objects of type Foo::Expression::Arithmetic. Foo::Expression::Arithmetic has a output function, so outputing $c1 and $c2 gives me the following: a - 10 + 20 + 30 - 40 # $c1 a - 10 + 20 + 30 - 40 * a # $c2Now i want to be able to do the following: not achieve the following output: ( 10 + 20 ) * a # $c3 is not working. :-( Any ideas? 2006-02-07 Retitled by Arunbear, as per Monastery guidelines
Back to
Seekers of Perl Wisdom
|
|