use strict;
use warnings;
my $html = <www.example.com
job.example.com
Web: info.example.com
And another
Web site: another.example.com (doesn't always work)
Nice blog here: blog.example.com
END_HTML
use Test::More tests => 1;
$html =~ s{(http://(\S+)(?:/\S*)?)}{$2}g;
is($html, $target);