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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
Code not working



Mar 25, 2003, 7:54 PM

Post #1 of 2 (372 views)
Code not working Can't Post

$page =~ s{<%!%WYSIWYG%!%>.*?<%!%WYSIWYG%!%>} {<%!%WYSIWYG%!%>$new<%!%WYSIWYG%!%>}m;

Basically Im taking the variable $page, and getting all the content between the <%!%WYSIWYG%!%> tags, and replacing it all with $new.... Is this the wrong way to go about it or is there something simple wrong with it?

Thaumaturge / Moderator

Mar 26, 2003, 1:11 AM

Post #2 of 2 (369 views)
Re: [mscott0] Code not working [In reply to] Can't Post

Seemss to work for me. Here's my test program.


use strict;
use warnings;

my $page = do { local $/; <DATA> };

my $new = 'the replacement text';

$page =~ s{<%!%WYSIWYG%!%>.*?<%!%WYSIWYG%!%>}

print $page;

Here is some text
<%!%WYSIWYG%!%>something in the text<%!%WYSIWYG%!%>
Some other text.

What problems are you seeing?

Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks


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

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