use URI; my $url = URI->new( $ARGV[0] || die "Give a URI\n" ); $url->scheme =~ /https?/ or die "This is not a URL we can use...\n"; print $url, $/, $url->host, $/, $url->path, $/; __END__ perl ~/getrequest.pl http://nasa.org/moon http://nasa.org/moon nasa.org /moon