if (eval "require LWP::UserAgent; 1") { my %post = ('key' => 'value'); my $ua = LWP::UserAgent->new(); my $content = $ua->post("http://www.mydomain/post.cgi",[%post])->as_string; #do something with the content ... } else { print "LWP not available"; } #### Can't locate object method "post" via package "LWP::UserAgent" (perhaps you forgot to load "LWP::UserAgent"?) at (eval 2) line 1.