Hi, all -- If I have a string like
my $string = "Hello, #NAME_FIRST# #NAME_LAST# from #STATE#!" ;
and I want to replace those chunks each with another string, what is a
good way to approach that? I'd love to use something like
my %xlate =
(
NAME_FIRST => "David",
NAME_LAST => "T-G",
STATE => "confusion"
) ;
that I can load up for each record and then just throw it at the master
string and get a custom version out, but I don't see how to do that. For
instance, in php, I would write something like
$fields = array('#NAME_FIRST#','#NAME_LAST#','#STATE#') ;
$values = array('David','T-G','confusion') ;
$custom = preg_replace($fields,$values,$string) ;
and be done.
TIA & HAND
:-D
--
David T-G * There is too much animal courage in
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
pgp00000.pgp
Description: PGP signature
