Beefy Boxes and Bandwidth Generously Provided by pair Networks BBQ
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How can I enter the data of different variables from a text file into a perl program?

by moritz (Cardinal)
on May 05, 2012 at 19:38 UTC ( #969075=note: print w/ replies, xml ) Need Help??


in reply to How can I enter the data of different variables from a text file into a perl program?

I happen to have written a module which understands that syntax. You could use it like this:

use strict; use warnings; use 5.010; use Math::Expression::Evaluator; my $m = Math::Expression::Evaluator->new; # read all the variables $m->parse("x1=3.8; x2=5.8; x3=4.1; y1=10.1; y2=11.6; y3=12.7")->val; # do the calculations you are interested in: say $m->parse("x1 * x2")->val;

Not saying it's the best solution, it just happens to work :-)


Comment on Re: How can I enter the data of different variables from a text file into a perl program?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2014-04-17 23:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (459 votes), past polls