#!/usr/bin/perl use warnings; use strict; use LWP::UserAgent; use HTTP::Request::Common; #unless ( scalar @ARGV == 1 ) { ... } # Apparently that would have been an alternative if ($#ARGV != 0) { print STDERR "Usage: $0 \"URL to fetch\"\n"; exit; } my $agent = new LWP::UserAgent; $agent->get(['http','ftp'],'http://search.cpan.org/~gaas/libwww-perl-5.808/lib/LWP/Simple.pm'); my $req = GET($ARGV[0]); my $res = $agent->request($req); if ($res->is_success) { print $res->content; } else { print $res->status_line,"\n"; }