in reply to Need help with a nested IF statement

Add another print before your 2nd if:
print ">>>$_<<<\n";
That should prove to you that $_ has what you expect it to have.