in reply to how to nullify case sensitivity

Are you aware that $a and $b are special variables (see perlvar) used by sort. Unless you are using them in that context, you would be well advised to pick different variable names.

The condition you're after can be written as:

if (lc($var1) ne lc($var2)) { ... }

-- Ken