damian has asked for the wisdom of the Perl Monks concerning the following question:
it reads the template.html and looks for "%%insert_here%% and substitute the html snipets of data.txt to the searched pattern. then it prints the value of @cat1 to foo.html. the problem is that it prints the contents of data.txt twice. the contents of data.txt doubles when it prints to foo.html. pretty weird huh! or it's just my code. thanks in advance print F $cat@cat1 = "template.html"; #template html $cat2 = "data.txt"; #data file contains html snipets open(F, ">foo.html"); foreach (@cat1) { s/%%insert_here%%/$cat2/ge; } print F @cat1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Weird printing
by ar0n (Priest) on Aug 09, 2000 at 08:33 UTC | |
by merlyn (Sage) on Aug 09, 2000 at 14:47 UTC | |
by jquiroga (Novice) on Aug 09, 2000 at 17:57 UTC | |
by jquiroga (Novice) on Aug 10, 2000 at 16:57 UTC | |
|
Re: Weird printing
by Anonymous Monk on Aug 09, 2000 at 12:08 UTC | |
|
Re: Weird printing
by damian (Beadle) on Aug 09, 2000 at 10:05 UTC | |
by LunaticLeo (Scribe) on Aug 09, 2000 at 19:53 UTC | |
by chromatic (Archbishop) on Aug 10, 2000 at 00:12 UTC | |
|
Re: Weird printing
by BigJoe (Curate) on Aug 09, 2000 at 16:32 UTC |