Content of $x after initialization is content 1

Content of $x at start of function is
Content of $x at end of function is content 2

Value of $x after calling fn() is content 1