From: "Azubi CAI" <[EMAIL PROTECTED]> > Hi there, > > I need to substitute a string in a .rtf file with a string from an > HTML form. I thought about using placeholders in the .rtf document and > then searching and overwriting them with the data from the HTML form. > I tried it out with that code: > > #!/usr/bin/perl -w > open PASSWD, "test.rtf" > or die "nichts gefunden ($!) "; > > while (<PASSWD>) { > chomp; > if (/welt/) { > s/welt/mars/; > } > } > > there aren't any warn messages from the compiler, but the string > "hallo welt" hasn't changed into "hallo mars". But whats' wrong? Or is > it a problem with the .rtf format?
You are not writing the results anywhere. Anyway there is one more problem ... you will have to escape the stuff you want to insert into the RTF. Plus it's sometimes not so trivial to find the right spot to put the placeholders if you edit the raw RTF and it's not guaranteed to work correctly if you enter the placeholder in MSWord or some other editor (the editor may insert some RTF markup into the placeholder!) You may want to use my http://Jenda.Krynicky.cz/#Template::RTF instead. Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]