powerhouse has asked for the wisdom of the Perl Monks concerning the following question:
This reads every $string in the text file, and replaces it with the perl value of $string since it normally would not, because of it being in a text file and not read as a string by Perl.open(FILE, "/home/user/template/$filename.txt"); while (<FILE>) { s/(\$[a-zA-Z0-9\{\'\}_]+)/ eval ($1) /ge; $template{'content'} .= $_; } close(FILE);
while(my ($db_name,$content,$_add_name) = $sth->fetchrow_array()) { s/\<templ_var ([a-zA-Z0-9\{\'\}_]+)\>/ eval ($1) /ge; s/{{([a-zA-Z0-9\{\'\}_]+)}}/ eval ($1) /ge; $_content = $_; if ($_add_name) { $_content = qq~<!--Start $db_name-->$_content<!--End $db_name- +->~; } $temp_vars{$db_name} = $_content; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: <FILE> Questions
by Chady (Priest) on Nov 10, 2003 at 14:42 UTC | |
|
Re: <FILE> Questions
by talexb (Chancellor) on Nov 10, 2003 at 15:44 UTC | |
by powerhouse (Friar) on Nov 11, 2003 at 05:06 UTC | |
|
Re: <FILE> Questions
by iburrell (Chaplain) on Nov 10, 2003 at 22:12 UTC | |
by powerhouse (Friar) on Nov 12, 2003 at 06:20 UTC |