Hi all, I am calculating polynomial values and then pushing those values into an array. For execution I am using this subroutine :
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);
}
And this is I am pushing values to the array.
push @CompareValues,&EvalPolynominal($$lvlhash{$level}{'POLY_BASED_EM_
+DC'}{'EM_POLY'}{11},$$refhash{$level}{'MINDESIGNWIDTH'},0);
print ("size ".@CompareValues. "\n");
I am reading all the polynomial equations from the text file and all of them are they stored in hashes. So that means 11 is one equation, 21 is another and so on. I am using the above script for 3 different equations, I am getting output from the last two and undef from the first one which is 11.
Here's the output when I do print dumper (\@CompareValues);
$VAR1 = [
undef,
'0.048648',
'0.048648'
];
I guess it's easy to do but I have no idea what am I doing wrong here and what's wrong because I am getting values for other equation. I would like to know what's wrong with this code, I'll be glad if some of few could help me.
Thanks.