Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: parsing a function

by vladb (Vicar)
on May 03, 2003 at 07:07 UTC ( #255270=note: print w/ replies, xml ) Need Help??


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:

my $function = 'b+c(t)+t^234.57*t^n*f(t)+Z'; $function =~ s/n/\$nvar/g; print "New function: $function\n";
Which should print

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


Comment on Re: parsing a function
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://255270]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2014-11-23 18:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (134 votes), past polls