my $first_name = "foo"; my $last_name = "bar"; my $string = 'Dear $first_name, $last_name; Blah.'; $string =~ s/\$first_name/$first_name/g; $string =~ s/\$last_name/$last_name/g; #or #$string =~ s/(\$\w+)/$1/eeg; #if you are sure all variables in the text will exist. print $string;
In reply to Re: Form letters: eval a string to substutite perl variables
by driver8
in thread Form letters: eval a string to substutite perl variables
by brycen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |