> Hi Experts,
> 
> I have a small problem. Maybe it is silly one .
> 
> I am writing a program which is reading an ini file and doing arithmatic 
> calculations
> specified in the ini file. The ini file looks like this
> 
> -----------------------------------------------------------
> A = (B + C) / D
> RESULT = DATAFROMFILE - DATACAL
> 
> ------------------------------------------------------------
> 
> The equations in the ini file are user defined and user can define any 
> arithmatic equation in the file !
> The values on right hand side are not known at the start of program and are 
> known during the execution
> from several query operations . The intention of the program is to evaluate 
> the expressions in the ini file
> and display the resultant values.
> 
> One way of doing this could have been  
> 
> Change ini file to perl program like
> 
> $A = ($B + $C)/$D  
> 
> then analyse the variables on right hand side , get their values and then 
> again read the ini file in the program
> with do function like
> 
> do "C:\\temp\\test,ini";
> 
> With this there is a danger of user inserting any execuatable perl command in 
> the ini file which can do any unintentional
> operation like
> 
> system("delete c:\\*.*");
> 
> 
> Another possibility is to keep the ini file as it is (specified initially 
> without $ sign).
> Read the ini file, add prefix of $ sign before variable name , write the 
> modified expressions
> in another ini file and then read this ini file with do statement
> 
> do "C:\\temp\\modtest.ini";
> 
> Somehow I am not comfortable with both alternatives. What I need is 
> 
> 1) Read ini file 
> 
>       A = (B + C) / D
>       RESULT = DATAFROMFILE - DATACAL
> 
>    Store the arithmatic expressions on right hand side in perl variables 
> after adding prefix of $, say   $LEFT{A} = ($B + $C) / $D  etc
> 
> 2) Evalute the variables on right hand side ..
> 
> 3) After values of all variables on right hand side are known, evaluate 
> complete expression with a function (this function will actually calculate 
> the 
>     the resultant value of Varible on right hand side eg.
> 
>     $A  = Eval { $LEFT{A}  }          # Just for example 
> 
> help me !
> 
> 
> With Best Regards,
> 
> Vidyadhar
> 
> 
_______________________________________________
Perl-Win32-Admin mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to