On 7/13/11 Wed  Jul 13, 2011  8:53 AM, "AKINLEYE"
<damola.akinl...@gmail.com> scribbled:

> please I need  to split a bunch of URL into their respective domain name
> like abcd.com  , it path direcory like /~bert/build/ , it's Argument
> constitutent like uid =1
> 
> Take for example
> msprogram.cn/update/ld.php?ld.php&id=1936&rs=1765405346&cc=0&uid=1
>  I need the first match to be mspgroam.cn
> The Directory to be /update/
> The File should be ld.php
> 
> and argument should be a bunch of v=1 ,rs=1765405346 , cc=0  uid=1

Parsing URLs and URIs is a common problem. When encountering a problem like
this that other people may have encountered before, your first thought
should be to search the CPAN repository at <http://search.cpan.org> for an
appropriate module.

For example, a few minutes searching on the terms "URL" and "URI" revealed
the URI module, which may have exactly the functions you are looking for.

Example:

use URI;
my $uri = URI->new('http://msprogram.cn/update/ld.php?uid=1');
print $uri->host() . "\n";

Outputs:

msprogram.cn



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to