sub ParseURL { my($url)= shift; my($protocol, $site, $login, $password); $url=~ /^(\w+):\/*([^\/]+)\/(.*)$/; # chunk the URL components $protocol= uc($1); # preserve matches in real variables $site= $2; $path= $3; if ($site=~ /\@/) { # check for the optional login field ($login, $site)= split("\@", $site); ($login, $password)= # check for the optional password field split(":", $login); return($protocol, $site, $login, $password, $path); } else { # no account information return($protocol, $site, "", "", $path); } }