use LWP::Simple qw($ua get); # export the underlying LWP::UserAgent into $ua ... $ua->timeout(10); # ... and set a timeout on it (seconds) my $doc = get('...') || die {$pass=0};