Math::Expr does exactly what you want. Release date is 2001-10-01, so it's fairly up to date.
Math::Expr - Parses mathematical expressions
Parses mathematical expressions into a tree structure. The expressions
may contain integers, real numbers, alphanumeric variable names,
alphanumeric function names and most other characters might be used
From the pod. That's no reason not to write your own as an exercise :)