Home: Perl Programming Help: Beginner:
output



jumaru
Deleted

Mar 17, 2000, 5:20 AM


Views: 1193
output

Hi everybody
look at this :
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


$reply = "<table width=\"502\" border=\"0\" cellspacing=\"2\" cellpadding=\"5\"><tr> <td width=\"166\" rowspan=\"3\" valign=\"top\" bgcolor=\"#0085A6\"><b><font color=\"#FFFFFF\">$nom</font></b></td><td width=\"310\" bgcolor=\"#00A5CE\"><i><b>$email</b></i></td></tr><tr><td width=\"310\" height=\"9\" rowspan=\"2\" valign=\"top\" bgcolor=\"#00A5CE\"> <p><font color=\"#FFFFFF\">$message</font></p></td></tr><tr></tr></table>\n<!--Reply here-->";

open (re, "<$count.html") or dienice("Couldn't open: $!");
$data = <re>;
close (re);
$data =~ s/<!--Reply here-->/$reply/;
open (fin, ">$count.html") or dienice("Couldn't open: $!");
print fin $data;
close (fin);
</pre><HR></BLOCKQUOTE>
instead of having $reply in the place of the comment I have this:
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


<table width="502" border="0" cellspacing="2" cellpadding="5">
</pre><HR></BLOCKQUOTE>
what's wrong
Thanks


[This message has been edited by jumaru (edited 03-17-2000).]


Jasmine
Administrator / Moderator

Mar 22, 2000, 4:32 AM


Views: 1193
Re: output

Unless I'm missing something, $data is your count and $reply contains the code you wish to perform the substitution on. Assuming that $data also contains a <!--Reply Here-->, and may have more than one line, add a m at the end of your regex:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


$data =~ s/<!--Reply here-->/$reply/m;
</pre><HR></BLOCKQUOTE>

which will tell your regex to look across multiple lines.

Hope this helps!


jumaru
Deleted

Mar 22, 2000, 5:22 AM


Views: 1193
Re: output

Thanks Jasmine, I'm gonna try it now