use strict; use Net::HTTP; sub listeners { my $port=shift; #print "Initializing port $port\n"; my $http=Net::HTTP->new(Host=>"localhost",PeerPort=>$port); $http->write_request('GET'=>'/7.html', 'User-Agent'=>'Mozilla/5.0'); #print "Reading in the HTML.\n"; my ($code,$mess,%h)=$http->read_response_headers; my $buff; my $n=$http->read_entity_body($buff,1024); die "Cannot read the buffer. $!" unless defined $n; my ($line) = $buff =~ /(.+)<\/body>/; my @sc=split(/,/,$line); return $sc[0]; }