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"; }