Hi everyone,
I have certain template files. The files look like this:
In my script I have the following code:
The reason I put everything in a string is to be able to do the following:
This works like a charm. The thing I am not sure of is the following:
This above script will run a couple of times wich results in growing $config. This $config will also have lines starting with # wich I want to remove. Since I now have a string and not an array I am not sure how to remove those lines. Is there a way to just convert the string to an array again?
thanks in advance.
InDenial
I have certain template files. The files look like this:
Code:
###########
# template name:
# purpose:
# etc...
###########
config line 1 containing a <VARIABLE>
another <VARIABLE1> in a config line
and another one. This time it is <VARIABLE3>
.
.
.
etc...
In my script I have the following code:
Code:
open (DEFAULT, "<$default_template") or die;
undef $/;
$config = <DEFAULT>;
close DEFAULT;
The reason I put everything in a string is to be able to do the following:
Code:
while (my ($config_item,$config_value) = each %config_items){
$config =~ s/<$config_item>/$config_value/g;
}
This works like a charm. The thing I am not sure of is the following:
This above script will run a couple of times wich results in growing $config. This $config will also have lines starting with # wich I want to remove. Since I now have a string and not an array I am not sure how to remove those lines. Is there a way to just convert the string to an array again?
thanks in advance.
InDenial