in reply to Re: Re: search replace (interpolation)
in thread search replace (interpolation)
This would be a hell of a lot more robust, maintainable and less obfuscated.
my $email_template = get_email_template_as_string(); my $sql = 'SELECT first_name, last_name, email FROM address_book'; my $sth = $dbh->prepare_cached{$sql} or die 'Error'; while ( my ($first_name, $last_name, $email) = $sth->fetchrow_array() +) { my $text = $email_template; $text =~ s/__FNAME__/$first_name/; $text =~ s/__LNAME__/$last_name/; # contiue with substitutions send_email($text); }
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|