in reply to Perl IF Issue

Are you sure the strings are exactly the same?

Try comparing them character by character:

die "Different length" if length $HOSTNME != length $SRVCHX; for my $pos (0 .. length($HOSTNME) - 1) { warn warn "$HOSTNME\n", " " x $pos, "| $pos\n$SRVCHX\n" if substr($HOSTNME, $pos, 1) ne substr($SRVCHX, $pos, 1); }

Also, do you use strict? Just to make sure there's no typo in the variables' names.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Perl IF Issue
by intoperl (Acolyte) on Aug 20, 2015 at 16:04 UTC

    Hi Choroba, thanks for your reply. yes i am using strict. And below is the output when i did the testting your ways :

    Different length at ./cpu_chk.pl line 149, <STDIN> line 1.