my $debugtemplate = 1;
my %values = (
foo => "Don't forget: use strict;",
bar => "-w is your friend"
);
while ( <TEMPLATE> ) {
s/<~([^~]*)~>/expand($1)/eg;
print;
}
sub expand {
my $token = shift;
return $values{$token} if exists $values{$token};
return $debugtemplate ? "<~$token~>" : "";
}
In reply to Re: Regex and HTML Question
by dws
in thread Regex and HTML Question
by r.joseph
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |