I inserted variables (e.g. account number) in specific locations within each file, and upon running the install script, I want the 'values' of these variables inserted. But, what is happening is that the raw variables are printed without interpretation.
Here is a sample of the code:
~~~~~~~~~~~~~~~~~~~~~~
sub newfile_create { $account_number = "12345"; $master_file = "/usr/local/foo/htdocs/master_file.txt"; open (IN, "$master_file") or die "Couldn't open file: $!"; $new_file_content = join("", <IN>); close (IN); # Note -- the 'master file' contains a variable, $account_number that +needs to be substituted when the file contents are written into the v +ariable, $new_file_content before writing this data into the $new_fil +e_path location (file). $new_file_path = "/usr/local/foo/htdocs/sub/file1.js"; open(IN, ">$new_file_path"); print IN "$new_file_content"; close(IN); return; }
~~~~~~~~~~~~~~~~~~~~~~
How can I get the $account_number var interpreted before writing to the new file?
Thank you.
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |