Jenda Krynicky [JK], on Thursday, September 16, 2004 at 00:34 (+0200)
typed the following:
JK> You most probably want to store the data you want to fill into the
JK> template in a hash (some call it associative array, please don't):
JK> my %data = (
JK> foo =>> 'test',
JK> bar =>> 'other'
JK> );
JK> my $string = "Here's [%foo%] and [%bar%] tests.";
JK> $string =~ s/^\[%([^%]+)%\]$/$data{$1}/g;
Jenda, thanks a lot for solution. As many other wrote, it is good to
use hashes. So I'll try.
JK> "Why it's stupid to `use a variable as a variable name'" by M-J.
JK> Dominus at http://www.plover.com/~mjd/perl/varvarname.html
interesting reading.
Good night!
--
...m8s, cu l8r, Brano.
[Expect the quest to break your heart at least once.]
-=x=-
Skontrolovan� antiv�rov�m programom NOD32
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>