intoperl has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks - Being a Newbie in perl, i am stuck in an if() situation in my code, which happens to check server health. Problem is, I am comparing 2 variables in if(), based on that perl will run commands locally or Remote, please the code snippet below :
I used arrows in below code to indicate whats what. Please help.sub cpuchk() { my $SRVCHX = shift; message("Server Received is : $SRVCHX"); ----> Testing to chec +k Server name passed from outside(good) message("host test : $HOSTNME"); ----> testing to check curre +nt hostname(good) if($SRVCHX eq $HOSTNME ) ------>Problem here - when both t +he values are same, it still does not execute if and goes to else { message("Local Server Selected, Executing commands loc +ally.."); localcpucmds(); } else { message("Remote server selected: $SRVC +HX"); . . Executes commands on remote server...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl IF Issue
by stevieb (Canon) on Aug 20, 2015 at 15:28 UTC | |
by intoperl (Acolyte) on Aug 20, 2015 at 16:00 UTC | |
by stevieb (Canon) on Aug 20, 2015 at 16:03 UTC | |
Re: Perl IF Issue
by choroba (Cardinal) on Aug 20, 2015 at 15:27 UTC | |
by intoperl (Acolyte) on Aug 20, 2015 at 16:04 UTC | |
Re: Perl IF Issue
by dasgar (Priest) on Aug 20, 2015 at 16:00 UTC | |
by stevieb (Canon) on Aug 20, 2015 at 16:13 UTC | |
by Monk::Thomas (Friar) on Aug 20, 2015 at 16:17 UTC | |
by stevieb (Canon) on Aug 20, 2015 at 16:26 UTC | |
by intoperl (Acolyte) on Aug 20, 2015 at 16:37 UTC | |
by intoperl (Acolyte) on Aug 20, 2015 at 16:38 UTC | |
by Monk::Thomas (Friar) on Aug 20, 2015 at 16:15 UTC | |
by intoperl (Acolyte) on Aug 20, 2015 at 16:36 UTC | |
Re: Perl IF Issue
by Random_Walk (Prior) on Aug 21, 2015 at 09:22 UTC |