in reply to Forcing Variable Interpolation

What template system are you using? If you're rolling your own, you're likely to start hitting serious limitations on what you would like to accomplish. My personal favorite is Template Toolkit. Here's a sample of how it works:

use strict; use Template; $|++; my $template = Template->new( { INCLUDE_PATH => '..\templates' } ); my %data = ( name => 'Ovid', colors => [qw/ red black green /] ); $template->process( 'some.tmpl', $data ) or die $template->error();

And then, in some.tmpl:

Hi [% name %] Here are some colors: [% FOREACH color = colors; color; "\n"; END %]

There are other templating systems, I just happen to find this one the most useful (and it's not tied to HTML). Check the above URL for more information.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.