Problem with if statement in perl

if (($fields[16] eq $hwp) && ($fields[18] eq 'Y'))
{
        $fields[22] = "INTEGRAL";
}
elsif ($fields[16] eq $hwp)
{
        $fields[22] = "INTEGRAL";
}
elsif ($fields[16] ne $hwp)
{
        $fields[22] = "SEPARATE";
}

print "$fields[16] $fields[18] $fields[22]\n";

Output:

The problem here is that the first condition is true so it should print INTEGRAL but it is printing SEPARATE.

I am absolutely clueless because the same logic is working fine for another condition in the program.

Cheers,
AK

Suggest you temporarily modify your code to print out $hwp. I think you will find that it's value is not 34.

if (($fields[16] eq $hwp) && ($fields[18] eq 'Y'))

Does $hwp = 34?