in reply to Usage of STDIN for file reading inside a module

I will second haukex here, STDIN is a global resource and modules really should not be explicitly using it unless that is their purpose, as in Term::ReadLine or similar. Further, modules should very rarely execute code at top-level and the convention is that module names in all lowercase are reserved for pragmas like strict and warnings.

There are several much better solutions, but unless you describe what you are trying to do, we will not really be able to help you. If you really are misusing the module system as a subroutine call, perhaps this will help: (untested)

use strict; use warnings; sub file_read { local $.; my $fh = shift; while (<$fh>) { print } return $.; } print file_read(\*STDIN), "\n";

See perlvar for what the $. variable does and perlreftut for a quick introduction to "that funny \ thing".