use strict; use warnings; use Data::Dumper; use URI::Find; my $data = do {local $/;}; my $finder = URI::Find->new( sub { my($uri, $orig_uri) = @_; return qq|$orig_uri|; } ); $finder->find( \$data ); print $data; __DATA__ Blah blah blah Web: http://www.example.com info.example.com Web: http://info.example.com/ And another Web site: http://another.example.com/ (doesn't always work) Nice blog here: http://blog.example.com/niceblog/ #### sub { my $u = URI->new( $_[0] ); return sprintf( '%s%s', $u, $u->host, $u->path ); }