http://qs321.pair.com?node_id=665687


in reply to Perl on Windows XP needs to grab internet txt file.

Ahoy kansaschuck!

LWP::Simple is an extremely useful module and I highly recommend using it for your http related needs. To retrieve a file from a remote server, the following code would work well:
#!/usr/bin/perl use warnings; use strict; use LWP::Simple; my $url = ''; my $file = ''; my $resp = ''; print 'Please enter a URL: '; chomp( $url = <STDIN> ); print 'Please enter a filename in which to store the data: '; chomp( $file = <STDIN> ); # We don't want to overwrite a file that already exists so using the ' +-e' essentially asks: Does a file of this name # already exist? If so, the message is displayed and the program exits +. if( -e $file ) { die "Sorry. That filename already exists.\n"; } # The 'getstore' function returns an http response code e.g. 200, 404, + etc. # The syntax says: Store the data obtained from '$url' in '$file'. $resp = getstore( $url, $file ); exit;


Hope this helps,

~Katie