OK, a coulple of basic things first. If I am "teaching you how to suck eggs", then my apologies.
Firstly, a URL consists up up to four components. Take this as an example:
http://www.dummyurl.com.au/directory/index.html?question=how
The parts are: (these are my own names - there is probably the "official" ones in an RFC somewhere)
- Protocol - the "http:" section. You can also see URL's starting with "ftp:" or "telnet:" and so on. This means we will use http as the transfer protocol.
- host and domain name - the "www.dummyurl.com.au". Somewhere there is a domain name "dummyurl.com.au". If you have access to a unix shell account, try nslookup. Read up about DNS - the Domain Name Service - that translates names to addresses. The "www" is a host connected to that domain, and has been the default web server host name. It doesn't have to be that tho.
- The file name - directory/index.html. Starting at the web server's "document root" directory, there will be a subdirectory "directory" containing a file "index.html". This is the html document that is returned to you.
- cgi "get" paramaters - the bit ?question=how. These are values that a "get" request will pass to a cgi program.
Now, there are much more detailed and complete descriptions of URLs that that, but I think you get the picture. So what you are wanting to do is to turn the domain name part in to its corresponding ip address. There are modules that can do that - Net::DNS is your friend here.
One question though is - why? Why do you need to know that "yahoo.com" has an ip address of 10.10.10.10? That may very well change tomorrow, but the name will remain (relatively) constant.