You have a variable of the same name ($my_line_in)
at two different scopes. The while loop uses my to localize that variable to the scope enclosed by the loop. It's value is not seen outside of the loop (or inside the sub's). Removing that "my" will give you what you probably expect to see, although it is not the best solution.