in reply to Template Question
Of course there are several ways to achieve this.
Leaving the file as-is, you could apply the substitution regex
$line =~ s/(\$[a-zA-Z0-9_]+)/ eval ($1) /ge;
This should work under the assumptions that you are using only scalar variables with names consisting of "standard" characters (let me be a bit sloppy about this issue) and that the $ character only appears in variable names.
Another possibility is making up a simple template language. I like to use <:name:> for placeholders to be interpolated. If your needs are limited, you can probably hack a quite stable solution in a few minutes.
Then, along the lines of cjf-II's suggestion, you can try one of the more complete templating solutions available on CPAN.
Cheers
Antonio
The stupider the astronaut, the easier it is to win the trip to Vega - A. Tucket
|
---|