Hi Guys,
I'm a Perl newbie and was wondering if there's a way of displaying
double quotes within double quotes.
I'm try to print the contents of the variable to a file by using the system function.
Here is an example of my code:
#==============================
$website = <STDIN>;
chomp $website;
$virtualhost_file = <STDIN>;
chomp $virtualhost_file;
$WebsiteConfFile = " \<VirtualHost *:80\>
ServerName $website
ServerAlias $website
DocumentRoot
\"/home/$website\"
TransferLog /home/$website/logs/access_log
ErrorLog /home/$website/logs/error_log
";
system("echo \"$WebsiteConfFile\" > /etc/httpd/vhosts.d/$virtualhost_file");
#==============================
This is what it displays in the file:
#==============================
<VirtualHost *:80>
ServerName
Test.com Web Based Testing Software
ServerAlias
Test.com Web Based Testing Software
DocumentRoot
/home/www.test.com
TransferLog /home/www.test.com/logs/access_log
ErrorLog /home/www.test.com/logs/error_log
#==============================
However if I use the print function to print to the console it prints out fine
see below:
#==============================
<VirtualHost *:80>
ServerName
Test.com Web Based Testing Software
ServerAlias
Test.com Web Based Testing Software
DocumentRoot
"/home/www.test.com"
TransferLog /home/www.test.com/logs/access_log
ErrorLog /home/www.test.com/logs/error_log
#==============================
Maybe the system function is not the function to use in this instance.
Any ideas?
Many thanks
kbdesouza