Maybe $elem has an extra \n that needs to be chomped?
In reply to Re: Equal strings don't match! by olus in thread Equal strings don't match! by pl