in reply to [SOLVED]Unable to split $ARGV[0] variable. Can it be done?
.pm is usually for modules which don't usually take arguments in the way you seem to want. So, I'd recommend changing the name to getrequest.pl, or something more descriptive as it sounds like it's doing a lot. I would highly recommend URI as mentioned by space_monk
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Unable to split $ARGV[0] variable. Can it be done?
by Doozer (Scribe) on Dec 11, 2012 at 09:12 UTC | |
by Your Mother (Archbishop) on Dec 12, 2012 at 03:55 UTC |
In Section
Seekers of Perl Wisdom