You are on the right track, but get() won't give you an error if the page is not found. ...You might not need that though.
Anyway I rewote your code a bit so that you can pass the URL to the sub, and save the page/data to a file. # I think this is what you were asking... use LWP::Simple; my $URL = 'http://www.mcn.net/~kenpom/cbbgames.txt'; my $file = get_games_file($URL); # open a new file open OUT, "> somepage.html"; # binary mode is only needed if saving # binary data, otherwise optional binmode OUT; # print to the file print OUT $file; # close the file close OUT; sub get_games_file { my $URL = shift; my $gamefile = get($URL) or die "Failed to get " .. $URL .": $!"; return $gamefile; } Rob -----Original Message----- From: Jeff Self [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 20, 2001 4:34 PM To: [EMAIL PROTECTED] Subject: How to grab a file from web? I'm trying to automate a process of grabbing a file from a website. I could do a system call and use wget but I would like it to be as portable as possible. Here's my function I've written so far: sub get_games_file() { »·······use LWP::Simple; »······· »·······my $URL = 'http://www.mcn.net/~kenpom/cbbgames.txt'; »·······my $gamefile = get($URL) or die "Failed to get " .. $URL .": $!"; } This doesn't give me any errors but it doesn't save the file to my computer. Am I on the right track or is there another function that works better? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]