I have some boilerplate text files with some variables I'd like to substitute. I'd then like to create new files with the appropriate substitutions based on those; for example (one of the boilerplate text files):
Hello $FIRST_NAME. I'm writing on behalf of $COMPANY...
How would I go about using those files to create new files with the substituted values, so the new file would then be
Hello James. I'm writing on behalf of SoftLayer...
The following works
my $outfile = "new.txt"; open (OUTFILE, ">> $outfile") || die "Can't open $outfile\n"; print OUTFILE "\n"; print OUTFILE "Hello $FIRST_NAME.\n"; print OUTFILE "\n"; print OUTFILE "I'm writing on behalf of $COMPANY...";
But I can't figure out how to do the above while keeping the boilerplate text files seperate from the script itself and still printing the substituted variables rather than the literal names of the variables.
Any help would be greatly appreciated.
In reply to Reading from/writing to files with variables substitutions by Qukz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |