On Wed, Oct 08, 2003 at 02:44:11PM +0200, Jenda Krynicky wrote:
> From: "Rob Dixon" <[EMAIL PROTECTED]>
> > <[EMAIL PROTECTED]> wrote:
> > >
> > > 1 - What is the best char to use in a file template?
> > >     Also, please give me a good regex?
> > >
> > > I will have a formatted html page with some keys that I want to
> > > replace.
> > 
> > Your substitution is fine, just add a /g to it to change all tags in
> > the string instead of just the first. Like this
> > 
> >   $line =~ s/<!-- fname -->/$fname/g;
> > 
> > Unless you have a good reason to read in the whole file at once,
> > process it a record at a time.
> 
> Of course keep in mind that your tokens cannot span several lines 
> then:
> 
>       <!-- fname
>       -->
> 
> would not work.

Also, keep in mind that there are a multitude of CPAN modules that will
do this for you.  If you choose wisely you will have a solution that
grows with your needs, even though you might not think your needs will
grow.

Off the top of my head, I think that the most popular modules will be
Template Toolkit, Mason, HTML::Template and Text::Template.

This is a wheel that really isn't worth reinventing.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to