Skip navigation.
Home
Your source for Perl tips, howto's, faq and tutorials
( categories: )

Use the function 'getstore' from the LWP::Simple module. The return value of the function is the HTTP response code.

Example:

#!/usr/bin/perl
 
use LWP::Simple;
 
#-- fetch the zip and save it as perlhowto.zip
my $status = getstore("http://www.perlhowto.com/archive.zip", "perlhowto.zip");
 
if ( is_success($status) )
{
  print "file downloaded correctly\n";
}
else
{
  print "error downloading file: $status\n";
}