CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
output

 



jumaru
Deleted

Mar 17, 2000, 5:20 AM

Post #1 of 3 (659 views)
output Can't Post

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

Post #2 of 3 (659 views)
Re: output [In reply to] Can't Post

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

Post #3 of 3 (659 views)
Re: output [In reply to] Can't Post

Thanks Jasmine, I'm gonna try it now

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives