#!/usr/bin/perl use strict; use URI::URL; use constant BASE => 'http://www.pair.com/pair/support/index.html'; print "BASE is ", BASE, "\n\n"; while ( chomp(my $path = <DATA>) ) { &tryit( $path ); } sub tryit { my $relative = shift; my $path = URI::URL->new($relative)->abs( BASE, 1 ); print "$relative ->\n\t$path\n\n"; } __DATA__ http://www.pair.com /index.html https://www.pairnic.com/faq.m search/ library.html
In reply to Re: Converting relative URLs to absolute URLs
by zentara
in thread Converting relative URLs to absolute URLs
by mkurtis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |