use strict; use threads; use LWP; my $uri; if (@ARGV > 0) { $uri = shift; } my $ua = LWP::UserAgent->new() or die "Can't create ua\n"; if (defined $uri) { print "uri: $uri\n"; my $r = $ua->get($uri); if (not $r->is_success()) { print "GET error on <$uri>...\n" . $r->error_as_HTML() . "\n"; exit(1); } } my $t = threads->new(\&threadedRequestThread) or die "Can't create thread\n"; print "Joining thread\n"; my @ret = $t->join(); print "Thread returned (@ret)\n"; exit(0); # Actual Thread function sub threadedRequestThread { print "Inside threadedRequestThread\n"; return "A list of words"; }