I have a Perl script into which I would like to call different sets of parameters depending on the input.
e.g.
command: myscript.pl [parameter_file_name]
where [parameter_file_name] is one of:
myparameters_1.pl
myparameters_2.pl
etc...
each file containing parameters of the form:
How do I call the myparameters files into myscript.pl and parse the parameters into a useable format? Is there an "elegant" way of doing this without resorting to:
I'm not sure I explained myself very well there but any help would be much appreciated...
Thanks in advance!
e.g.
command: myscript.pl [parameter_file_name]
where [parameter_file_name] is one of:
myparameters_1.pl
myparameters_2.pl
etc...
each file containing parameters of the form:
Code:
$parameter1 = value1;
$parameter2 = value2;
etc...
How do I call the myparameters files into myscript.pl and parse the parameters into a useable format? Is there an "elegant" way of doing this without resorting to:
Code:
@line = split("=",$_);
if ( $line[0] eq "parameter1" ) { $parameter1 = $line[1]; }
if ( $line[0] eq "parameter2" ) { $parameter2 = $line[1]; }
etc...
I'm not sure I explained myself very well there but any help would be much appreciated...
Thanks in advance!