Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 exploiting the Monastery: (5)
As of 2015-07-29 01:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls