Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: string to expression

by mkirank (Chaplain)
on Jan 10, 2007 at 03:35 UTC ( #593820=note: print w/replies, xml ) Need Help??


in reply to string to expression

check overload
#!perl use strict; use warnings; my $num = new SomeThing 57; $b=5+$num; print "b is $b \n"; my $minus = $num - 10; print "minus is $minus \n"; package SomeThing; sub new { my $p = shift; bless [@_], $p } use overload '+' => \&myadd, '-' => \&mysub; sub myadd { my $self = shift; my $var = shift; return ($var + $self->[0]); } sub mysub { my $self = shift; my $var = shift; return ( $self->[0] - $var); } 1;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://593820]
help
Chatterbox?
[1nickt]: I think it is indubitably fast. But it's not a drop in replacement. And I tend to be leery of putting too many eggs in these one-man baskets.
[LanX]: interesting the author doesn't seem to accept javascript as a scripting language
[LanX]: ... and calls php7 the winner oO

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2017-05-22 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?