At 7.34 97/4/2, Charles Cave wrote: >The only outstanding task is to write some code to see if >a URL is still valid. If I have a URL in a variable, >what functions do I need to check the validity of the URL? > > >$url = "http://www.microsoft.com" ># write some code to access www.microsoft.com and see if ># the URL is valid. The above line is valid, the next line ># is not. > >$badurl = "http//www.microsoft.moc" It depends on what you mean by "valid." I am assuming that you mean that the address actually exists, in which case the only way to do it is to actually open a socket and see if you can connect. Of course, a server could be down, and then it might be a valid URL but you wouldn't be able to connect anyway. But if you wanna do that, use LWP. use LWP::Simple; if (head($url)) { # ok document exists } Of course you might just mean, "does the URL conform to the set standards for URLs?" If that is the case, then you would need to look up the RFC for it (the number I don't know) and check out the specs. Also, as per your example, you would want to add a checker for the top-level-domains (TLDs, like .com and .edu), which would need to be flexible, as more TLDs are proposed and might exist within the year. I am not sure if LWP or any module can already check for proper URL syntax, or if someone has written a regex to check it. #================================================================ Chris Nandor pudge@pobox.com PGP Key 1024/B76E72AD http://pudge.net/ Keyfingerprint = 08 24 09 0B CE 73 CA 10 1F F7 7F 13 81 80 B6 B6