use URI; use URI::Find; use strict; use warnings; my $text = <<'__TEXT__'; Hi there, please read http://perlmonks.org/?node=How+to+RTFM. That's http://perlmonks.org/index.pl?node_id=78752. Students can activate their UMSIS userids on-line by filling out and submitting the form at https://umsis.miami.edu/sign-up. ...which can be obtained via the web at http://www.miami.edu/it-forms/. Holy snot http://batman.com, would you look at this!?!?! __TEXT__ find_uris($text, sub { my ($find_uri, $orig_uri) = @_; my $uri = URI->new( $orig_uri ); $uri = $uri->canonical->as_string; return '' . $uri . ''; }); print $text; __END__ Hi there, please read http://perlmonks.org/?node=How+to+RTFM. That's http://perlmonks.org/index.pl?node_id=78752. Students can activate their UMSIS userids on-line by filling out and submitting the form at https://umsis.miami.edu/sign-up. ...which can be obtained via the web at http://www.miami.edu/it-forms/. Holy snot http://batman.com/, would you look at this!?!?!