in reply to Problem Reading __DATA__ in a Module
The million dollar question is, why are you using globals to pass data into a method? Either the filehandle should be an attribute encapsulated in the object, or something passed in explicitly to the method call. Or it could even be a static package variable, with access through a class method.
If you really really really really want to "pass" data to your method this way, just call the variable by its fully-qualified name $Module::fh from test.pl.
Update: Looking even more closely, you should have $fh = \*DATA (note the backslash). Although my previous suggestions still apply as well.
blokhead
|
|---|