How about storing it in a subroutine instead?
my $func = sub { my $x = shift; return 3 * ( $x**3 ) - 2 * $x + 4 }; my $to_x = $func->( $x ); my $to_y = $func->( $y );
eval is a big, dangerous stick to carry around.
In reply to Re: Recover a mathematical expression from a string.
by chromatic
in thread Recover a mathematical expression from a string.
by misho
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |