http://qs321.pair.com?node_id=315972


in reply to Loop behavior with HTML::TokeParser::Simple

Probably the regex is failing because of the metacharacters in $src. Try s/\Q$src\E/$newsrc/ (untested) to make the regex work.

However, the better solution is to chuck the regex. It replaces $src in its entirety, so a simple $src = $newsrc (or replace both lines with $token->set_attr('src', $newsrc);) would be both easier to maintain and more effective.

HTH