|
Hmm... Let me see if I can try...
1. create a hash called %config.
2. open the file "config.txt" or quit if can't open it. Open it to a scalar variable called $config. This is a little confusing. Now you have a hash and a scalar used as a file handle. Two different variables.
3. Using the file handle ($config) loop over each line of the file. This loads each line into $_
4. Remove the newline at end of each config.txt line (now in $_)
5. Parse the line. Put the FIRST field (fields separated by "=") into the variable $key, the rest goes into array @value... Config must look like "X=something, and more, and more" doesn't matter what's there, everything after the = goes into @value
6. Now load what was in config.txt into the HASH called %config. Put the KEY parsed in the line above into the hash index $config{$key} and the rest of the line (what ever was after the "=" in config.txt) into the data part of the hash....
How's that???
|