While I don't know why it's doing that. I think I got around the problem by using $input rather than $$?=
I say "think" due to the fact that it's been a couple of years.