convert read data to variable
Posted on 2002-05-06
I have a text file called file1.txt. I want to be able to read in a line of that file (let's say the line is "score=2"). I now want to be able to use that as a variable and value in my current program.
In other words, I now want to have a variable called "$score" in my current program and have it's value set to "2" based on the data I read in from the text file.
I don't know what I will be reading in from the text file but I do know that it will always be [variable]=[value] so I can't predetermine the variable name because I don't know what it will be until I read it from the text file.
Is this possible? and if so how do I do it?