Charles Pelkey wrote:
> $_ =~ s/{(.*?)}/${$1}/g; # Find variables in the form of
> {var_name} and replace with $var_name
Eek -- symbolic references.
> Does anyone have an idea of how to fix this???
Use a hash :)
s/\{([^}]*)\}/$var{$1}/g;
Should replace {Full_Name} with $var{'Full_Nam
Carl Jolley wrote:
>
> It's not entirely clear to me but do you mean that the braces
> are included in the data that you are trying to match? If yes,
> yoy will have to quote the braces in your regex since braces
> are regex meta characters e.g.
>
> $contents =~ s/\{(\w+)\}/$1/g;
I don't think
Charles Pelkey wrote:
>
> Ok, maybe I did not explain this properly...
> I want the text inside the braces to be replaced with the value of the named
> variable:
> -
> Example script:
>
> #!/web/perl/bin/perl
> use CGI qw/:standard/;
>
> $Full_Name = param('Full_Name');
> $E
Ok, maybe I did not explain this properly...
I want the text inside the braces to be replaced with the value of the named
variable:
-
Example script:
#!/web/perl/bin/perl
use CGI qw/:standard/;
$Full_Name = param('Full_Name');
$E_Mail = param('E_Mail');
open (TMPL, "/pat