In addition to the suggestions about checking the values of the two variables, I've got two ideas. First thought: do you have the variable names correct? Using a variable named $HOSTNME instead of $HOSTNAME seems a bit odd to me personally and I'm just wondering if you might have a slight typo there. As choroba pointed out, using strict will help catch this kind of typo with variable names.
The other idea is that maybe the two variables have basically the same string, but without exact case matching (such as 'MyServer' and 'myserver'). The eq operator is looking for exact matches, which means that it is doing case-sensitive matching.
If you want/need case-insensitive matching, you just need to use a simple regex instead. Basically, change:
if($SRVCHX eq $HOSTNME )to be:
if($SRVCHX =~ m/$HOSTNME/i )In reply to Re: Perl IF Issue
by dasgar
in thread Perl IF Issue
by intoperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |