in reply to Re: Re: Re: Re: Re: Re: Re: the search string and me
in thread the search string and me
Why don't you build your templating system around a hash? Store every value you ever want to use in one hash, let's call it %var, and do the substitution like this:
Dead easy. You can simply use %params as your hash, or copy the desired values to %var first:$fld =~ s/\$(\w+)/$var{$1}/g;
If your template contains "$(greet)" it'll get replaced by "Hello".%var = (%params, foo => 'this is a new or changed field', bar => 'and + another', greet => 'Hello');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Re: Re: Re: Re: the search string and me
by wolis (Scribe) on Sep 23, 2003 at 05:02 UTC |