in reply to GetOptions Help Needed

Without reading your code too close, I think it is because your decon_server subroutine gets called too early:

my %options = ( ... "decon" => \&decon_server, ); ... die_usage() if (!GetOptions(%options));

decon_server will get called from within GetOptions(), which is too early since none of the connection setup has happened yet.

I would suggest that the approach of setting a flag, as used in the other options, is likely better:

my %options = ( ... "decon" => \my $do_decon_server, ); ... die_usage() if (!GetOptions(%options)); ... if( $do_decon_server ) { decon_server(); };

Replies are listed 'Best First'.
Re^2: GetOptions Help Needed
by MysticElaine (Novice) on Aug 20, 2018 at 16:19 UTC

    Thank you for the quick response. I have been trying to make it work :) I believe you are right as now I get some things popping up, but the answer for all variables is the same, so I am doing something wrong with the calling of the subroutine and returning the answer :( I think pulling all-nighters are bad, lol - as I'm sure it will be something simple.