#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; my $url = "http://www.google.com/"; my $file="code.html"; my $ua = LWP::UserAgent->new(); my $rsp = $ua->get($url); if($rsp->is_success()) { open (my $fh, ">:raw", $file) or die "ERROR open $file ($!)"; print $fh $rsp->content(); close ($fh); } else { die $rsp->status_line(); }