
thebitch
User
Aug 9, 2002, 7:18 AM
Post #4 of 4
(15250 views)
|
Re: [ebu] $str =~ s{>([^<>]+?)<(?{ local $l = $1;})}{($l
[In reply to]
|
Can't Post
|
|
you're using the wrong tool for the job. use HTML::Parser or HTML::TokeParser or something similar (XML::Parser or what have you) $l starts being "initialized" only after the first match because you're assigning $1 to it. $1 will only contain a value after you match something, which happens after you match something, so until you match something, $1 will not be defined ( it will be uninitialized). adddto the top of your script to see extra debugging output You've chosen the wrong approach, and that hairy regex ain't gonna cut it (it can be fooled). please go to CPAN and get yourself a HTML parser, they're very easy to use, easier than Regular Expressions
|