in reply to Replace placeholders in text in an elegant manner
use Text::Template; my $template = Text::Template->new( type => "FILEHANDLE", source => *DATA, ); my $text = $template->fill_in( hash => { placeholder1 => "chicken", placeholder2 => "dog", }, ); print $text; __END__ This is text with { $placeholder1 }. It can be with { $placeholder2 } too. { $placeholder1 } can appear more than one time in the text.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Replace placeholders in text in an elegant manner
by CountZero (Bishop) on Feb 28, 2010 at 08:42 UTC |