Sorry for the misunderstanding. I wasn't assigning $ur with a value in code. The question is updated now.
The value of $ur remains constant throughout the looping of lines.
I cannot exactly paste all the code here. I am not allowed to.
And yes, I am using "use Strict", "use Warnings".