use strict; use warnings; use Text::Template; my $template = Text::Template->new( TYPE => 'STRING', SOURCE => 'fred has {$color} eyes' ); our $color = 'blue'; print $template->fill_in;