http://www.perlmonks.org?node_id=1197197


in reply to Passing a filehandle to subroutine

What do you mean by losing the line? That it does not print or that it does not get stored in @ref? Consider the following suggestions:

  1. Use tell to remember the position in the file before you read each line, and use seek to reposition the pointer to there before calling SubOut
  2. Print $line before calling SubOut or pass $line to SubOut and push it onto @ref there

But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)