#!/usr/bin/perl -w use strict; use IO::Socket::PortState qw(check_ports); my $proto = 'tcp'; my $port = '8307'; my $address = '127.0.0.1'; my %hash = (); #########This works ######################################## my($section, $ping_timeout, %porthash); $porthash{$proto}{$port}{'name'} = $section; print "here is the $port"; check_ports($address, $ping_timeout, \%porthash); my $open = $porthash{$proto}{$port}{'open'}; if ($open) { print "alive\n"; } else { print "dead\n"; } #################################################################