my $hasLWP = eval{require LWP;}; if( $hasLWP ){ print "LWP is installed\n"; } else{ print "LWP not installed.\n"; }