in reply to adding hostnames to absolute links
Disclaimer: this is untested.$doctext =~ s/(a href=")([^"]+)/$1 . link_check($2)/eg; sub link_check { my $link = shift; # $hostname is a global or block lexical return $link if ($link =~ /^http://$hostname/); $link =~ s!(http://[^/]+)?!$hostname!; return $link; }
Update: Changed the second $1 on the RHS to $2, as originally intended.
|
|---|