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;
In reply to Weird printing by damian
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |