in reply to Problem comparing two variables

Those facts you provided don't agree with each other. Let's try this, before that if, print $item, and $in, as this:
print "=$in=\n"; print "=$item=\n";
This will either help us to figure out the true value of $item and $in, or confirm this is not a problem at all, so we can focus on other places.