Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://255270]
help
Chatterbox?
[Your Mother]: I like Manu Chao.
[Your Mother]: I like this one quite well, https://www. youtube.com/watch? v=rSEUH4KRfN8
[choroba]: Půlnoční Marie (which means Midnight Mary)
[choroba]: but the band is practically dead. We rehearse once in a year, and perform with the same frequency
[ambrus]: `quote
[ambrus]: sorry, typed in the wrong box
[LanX]: Your mother: je ne t'aime plus! ;)
[choroba]: seems lispy
[Your Mother]: Be nice! I speak that much French. Though I also like that song.
[choroba]: So, I joined Pod Černý Vrch some months ago to still have the fun. But I wouldn't call it "punk" anymore...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (14)
As of 2017-03-24 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (301 votes). Check out past polls.