I that situation I use place holder text that is replaced at run time using a regex and a hash lookup. Something like the following:
my %subs = (home => 'HomePathFromConfigOrEnv'); my $keyMatch = join '|', keys %subs; my $cfgStr = '!home!/path'; $cfgStr =~ s/!($keyMatch)!/$subs{$1}/g; print $cfgStr;
Prints:
HomePathFromConfigOrEnv/path
|
|---|