I have an array of url's that i have extracted from a website which means there are relative url's and absolute ones in my array. I have found the URI module which seems better than the URI::URL one, and am trying to make all my url's absolute. This is my code:
my $base_url = "http://www.perlmonks.com/"; my $uri = URI->new("http://www.perlmonks.com"); foreach(@links) { # This loop is to make all the relative url's absol +ute $uri = URI->new_abs( $_, $base_url ) } print "@links \n";
I have tried this but to no avail. The elements of the array still come out in the same way as they used to, some relative and some absolute. From the URI documentation there doesn't seem another good way of doing this. I think this should be pretty simple as i have the absolute url but i can't seem to do it. Any ideas? Thanks.
In reply to Turn relative url's to absolute with URI by lampros21_7
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |