in reply to string substitution help

Instead of inventing Yet Another Templating Solution, you might also consider Template Toolkit. Here's something I whipped up in 5 minutes from your source. Note the alternative provided for sender email:
#!/usr/bin/perl -w use strict; $|++; use Template; my $result = Template->new ( START_TAG => '<', END_TAG => '>', )->process(\*DATA, { recp_name => 'Recipient name', send_name => 'Sender name', ## send_email => 'sender@example.com', site_url => 'http://example.com/some/place', }) || die Template->error; __END__ Hey <recp_name>, I was surfing the web and I stopped by a pretty cool site that I think + you might be interested in. It is filled with cool information, good link +s, funny pics, and more, so be sure to check it out! Here is the address of the site: <site_url>. <send_name> <IF send_email; send_email; ELSE; "[no email specified]"; END>

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: &bull;Re: string substitution help
by emilford (Friar) on Sep 23, 2002 at 12:53 UTC
    Hey Merlyn

    Thanks for the reply; I figured out what my problem was.

    If there's one thing I've learned from frequenting PM.org, it's to always use strict and -w. The snippet of code I posted was just that...a snippet. The rest of the code does contain use strict and -w.

    Either way, I found my careless error. Thanks for the post.