use strict; use warnings; use 5.010; use Math::Expression::Evaluator; my $m = Math::Expression::Evaluator->new; # read all the variables $m->parse("x1=3.8; x2=5.8; x3=4.1; y1=10.1; y2=11.6; y3=12.7")->val; # do the calculations you are interested in: say $m->parse("x1 * x2")->val;