Hi Folks
I've got a little Perl program that reads in variables from an external file (config.txt). It uses a simple while loop to extract the contents of config.txt and split the name/values on the = sign.
I'd like to put in some error checking into my program that makes sure that all variables have been included in config.txt. At the moment, if I remove a variable from config.txt I get errors.
Therefore, how can I check that a variable actually EXISTS? Basically I need somethine like:
1. Read in file contents (DONE)
2. Split contents on = sign into name/values (DONE)
3. Check if e.g. $fname exists. If not, set it to a default value and continue.
Can this be done?
Cheers,
Kenny.
I've got a little Perl program that reads in variables from an external file (config.txt). It uses a simple while loop to extract the contents of config.txt and split the name/values on the = sign.
I'd like to put in some error checking into my program that makes sure that all variables have been included in config.txt. At the moment, if I remove a variable from config.txt I get errors.
Therefore, how can I check that a variable actually EXISTS? Basically I need somethine like:
1. Read in file contents (DONE)
2. Split contents on = sign into name/values (DONE)
3. Check if e.g. $fname exists. If not, set it to a default value and continue.
Can this be done?
Cheers,
Kenny.