This is only a trace you can follow:
- read the second file, parsing each line (split) and populating a hash with var=>value
- open a temp file in write mode (File::Temp)
- read the first file and, line by line:
- extract the left term with a regex
- use it as a key to the hash
- retrieve the value
- substitute it in the line with another regex
- write the new line to a temp file
- on end of file, close the files and copy the temp file back in place of the first file (File::Copy)
Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."