This is not a bug. You are assigning value "A" for the variable "$_tempvar". So it replace the orginal $_tempvar value which were taken from @test element originally.
What are you trying to do exactly with $_tempvar?
Perhaps you can tell us your intention, so we can give suggestions.