How about this setup which I think is clean way to do it.
Content of the config file, say cfg.cfg
%cfg = (To => 'to',
From => 'from',
Subject => 'subject',
Message => "message\nmsg2\n",
Page_Title => 'MailTo');
%cfg;
Then you do something like this in the main program.
use strict;
.
.
my $file = 'cfg.cfg';
my %cfg;
my $return = do $file;
unless ($return) {
die "couldn't parse $file: $@" if $@;
die "couldn't do $file: $!" unless defined $return;
die "couldn't run $file" unless $return;
}
%cfg = %{$return};
And then later in your code use it as
<td><select name="$cfg{From}" size="1">
more code...
</select></td>
</tr>
<tr>
<td>Subject:</td>
<td><input type="text" name="$cfg{Subject}" size="24">
+</t
This is easily expanded to have several different configs in the same file.
Ex $cfg{Guest}{To}, $cfg{Admin}{Page_Title}, etc etc