I'm constructing a script that reads files containing parameter names and their corresponding values. It can read multiple files and if there are values of the same parameter in more than one of the files the last value of the parameter should be used.
The problem is that to be able to achieve this I have to for every parameter in each file check if that parameter exists in the list (array) of parameters that already have been loaded. To do this I have written a small subroutine that loops through the list (array) of loaded parameters looking for the current parameter. This seems to be a very time consuming task since it takes quite some time to load a file containing many (>500) parameters. Is there a better (faster) way of doing this check? Please note if the parameter exists in the array I also need to know the index of it.