On Wed, 15 Sep 2004, Sheni R. Meledath wrote:
> How can I open an external file using Perl? The file is residing on another
> server. I have to call the file using http. Now the following is not working.
>
> $email_file = "http://www.mysite.com/data/emails";
> open (LIST,"<$email_file/address.txt");
The easiest approach is to use the LWP library bundle, and specifically
the LWP::Simple module, to retried the remote URL.
Quoting from `perldoc LWP::Simple`
use LWP::Simple;
$content = get("http://www.sn.no/");
die "Couldn't get it!" unless defined $content;
Or, in your case
use LWP::Simple;
my $url = "http://www.mysite.com/data/emails/adress.txt";
my $email_file = get( $url );
Install Bundle::LWP, read the perldocs, give this a try, then come back
to *this* list (not the CGI list) with any problems you may encounter.
--
Chris Devers
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>