in reply to Equal strings don't match!

Maybe $elem has an extra \n that needs to be chomped?