Solved

Absolutizing urls..

Posted on 2006-11-07
2
259 Views
Last Modified: 2012-06-21
Hi people,

I am trying to absolutize all urls.. but there is a prob. See example:

use URI::URL;

$url = "http://www.google.com/test";

I then put all links on $url, in an array: @pages. (i.e: all <a href="file.html"> tags)
So @pages = ("test.html","hi.html");

Then I try to absolutize all urls by doing:

@pages = map { $_ = url($_, $url)->abs; } @pages;

Then I print them by doing: print join("\n",@pages);

Then it gives:

http://www.google.com/test.html
http://www.google.com/hi.html

But.. it should have given:

http://www.google.com/test/test.html
http://www.google.com/test/hi.html

Any ideas?
0
Comment
Question by:TonyJix
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 17892740
0
 
LVL 11

Expert Comment

by:kblack05
ID: 17911122
Yes the trailing slash matters...
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
perl exit code 2 246
Perl Tutorial 6 127
Perl Awk Need Help 3 95
perl: Cleaning meta tags using RegEX 12 43
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now