in reply to File handle as a input variable

This is a frequently asked question.   See: How can I use a filehandle indirectly?