http://www.perlmonks.org?node_id=1160974

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, does someone knows a easy way to execute (calculate a simple equation) given in a string? This string is taken from a input file. E.g.:
my $x=0; $toCalc="($x+1)*2+1"; $x=calc($toCalc); sub calc {????? return ? }
Many Thanks !