in reply to regex vs split
open(TEMPLATE, "template.html") or die $!; my @xtemplate = <TEMPLATE>; close (TEMPLATE); my $xtemplate = join("", @xtemplate); # get these values from cgi or whereever $replace1 ="meep"; $replace2 = "narf"; # your markers @markers = ("TITLE", "STUFF"); # your replacement values, arrayisized (ITS A WORD I TELL YOU!) @replace = ($replace1, $replace2); for ($i=0; $i<@markers; $i++) { eval ("\$xtemplate =~ s/\\*\\*\\*\\*$markers[$i]\\*\\*\\*\\*/$repl +ace[$i]/g"); } # your formatted result print $xtemplate;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: regex vs split
by dragonchild (Archbishop) on Aug 23, 2001 at 17:25 UTC |