The main problem I see is that you never reset the value of
$connected between calls to
check. The scope of
$connected should really be limited to the subroutine, not the whole program. Move the
my $connected line inside the subroutine, and that may solve your problem.
-- Mike
--
just,my${.02}