sub blahify(\$$) { my $bla = ${shift()}; my $url = shift; my @x = (); my $host = $url; my $there = $url; $host =~ s%(http://[^/]*?/).*%$1%i; $there=~ s%(http://[^/]*?/.*/).*%$1%i; while($bla =~ m%(href="[^"]*")%ig) { my $boo = $1; next if $boo=~ m%href="http://%i; if( $boo =~ m%href="(/.*?)"%i) { push @x, $1; next; } printf STDERR "bad href: $boo\n"; } foreach (@x) { print "killing $_\n"; $bla =~ s/$_/$host$_/i; } my $foo = $x[0]; print "ALERT\n"if($bla=~/$foo/); return $bla; }