#!/usr/bin/perl -- use strict; use warnings; use Carp::Always; my $curWidth = my $curLength = 1; my $blah = q{-0.137 + (0.00479 / (W/0.9)) + (2.5593 * (W/0.9 ) ,0.045,0 }; print EvalPolynominal( $blah ); sub EvalPolynominal { #first parameter gives the polynominal string #second parameter gives the min-des width #third parameter gives the short-line length my $polynominal = shift; my $curWidth = shift; my $curLength = shift; $polynominal =~ s/W/$curWidth/g ;#replace W with current value of min width $polynominal =~ s/L/$curLength/g ;#replace L with current value of min Length return eval ($polynominal); } __END__ Use of uninitialized value $curWidth in substitution (s///) at blah line 18. main::EvalPolynominal('-0.137 + (0.00479 / (W/0.9)) + (2.5593 * (W/0.9 ) ,0.045,0 ') called at blah line 6 Having no space between pattern and following word is deprecated at (eval 1) line 1. eval '-0.137 + (0.00479 / (/0.9)) + (2.5593 * (/0.9 ) ,0.045,0 ;' called at blah line 20 main::EvalPolynominal('-0.137 + (0.00479 / (W/0.9)) + (2.5593 * (W/0.9 ) ,0.045,0 ') called at blah line 6