> I'm busy writing a script that uses an xml file for various
configurations.
> Amongst other things I want to move all strings that are printed on screen
> into the xml file, to be able to change these texts without hacking
the perl
> code (eg. for different languages).
>
> The challenge however is that I want to include other variables in this
> printed text, but I can't make perl to change the indirect variables
in the
> string.
>
>
> Example:
>
> This line could be in the xml file.
> <Msg>Moving $source to $destination\n</Msg>
>
> It becomes available in the script as:
> $config->{'Msg'}
>
> I also set the following variables:
> $source = 'logfile';
> $destination = 'logfile.0';
>
> When I simply print the string the following appears on screen:
> Moving $source to $destination\n
>
> Whereas of course I actually wanted
> Moving logfile to logfile.0
>
>
> Anyone know how to solve this?
>
> JP
>
In the past I have used a regex with 'eeg' to do the evaluation in
place. However when searching for an online example of that, my example
is in the Cookbook Recipe 1.8, I found a reference to perlfaq7 that
suggests that be avoided in favor of using a hash in a similar manner to
in the other thread recently discussed here. See the "How can I use a
variable as a variable name?" in,
perldoc perlfaq7
Specifically the part on why using 'eeg' on a regex should be avoided.
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>