You mean the input for the subroutine ? right ?
Is that what you need help with?
#!/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 li +ne 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 (e +val 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
eval is for perl code, not math
build a calculator with marpa dsl or use Math::GSL::Poly but don't use eval
In reply to Re^3: Regarding the polynomial evaluation. Stuck at one part. please helpppp!!
by Anonymous Monk
in thread Calculating polynomials and pushing them into an array. Stuck at one part. please helpppp!!
by freekngeek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |