in reply to Solving an expression

A solution probably already exists on CPAN, but you could build your own based on the code in this node (go down to section 5).