Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Using overload to parse arithmetic terms

by esskar (Deacon)
on Feb 07, 2006 at 12:01 UTC ( [id://528475]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $x1 = Foo::Number->new()->value( 10 );
    my $x2 = Foo::Number->new()->value( 20 );
    ...
    
    my $c1 = $v1 - $x1 + $x2 + $x3 - $x4;
    my $c2 = $c1 * $v1;
    
  2. or download this
    my $c3 = ( $x1 + $x2 ) * $v1;
    
  3. or download this
    use overload 
      '(' => \&left_parenthesis,    
      ')' => \&right_parenthesis,
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://528475]
Approved by Tomte
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-19 07:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found