in reply to parsing a function
How do I parse out n to a var named $nvar?
I'm either confused or failing to understand your question, but is a simple search and replace what you want to do here? In which case, you'd be looking at this code:
In case I got you wrong, however, could you please clarify your question? ;-)
_____________________
I'm either confused or failing to understand your question, but is a simple search and replace what you want to do here? In which case, you'd be looking at this code:
Which should printmy $function = 'b+c(t)+t^234.57*t^n*f(t)+Z'; $function =~ s/n/\$nvar/g; print "New function: $function\n";
New function: b+c(t)+t^234.57*t^$nvar*f(t)+Z
In case I got you wrong, however, could you please clarify your question? ;-)
_____________________
# Under Construction
In Section
Seekers of Perl Wisdom