#!/usr/bin/perl use warnings; use strict; use LWP::Simple; my $url = ''; my $file = ''; my $resp = ''; print 'Please enter a URL: '; chomp( $url = ); print 'Please enter a filename in which to store the data: '; chomp( $file = ); # 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;