in reply to Returning module pointer

Whilst it is perfectly valid to bless something into a package in a subroutine in another package, for future maintenance purposes you might want to abstract this further so that the ABC::Data object is actually being created in its own constructor:

package ABC; sub readdatafile { my ( $filename) = @_; # get the data into array as required return ABC::Data->new(\@data); } package ABC::Data; sub new { my ( $class, $ref) = @_; return bless $ref, $class; }
You probably would want to have more logic in ABC::Data::new() to check you really have got the right type of reference and so forth, but the advantage of doing this is that if at some point in the future you need to do some further processing on the data that is peculiar to the ABC::Data 'class' then you can stick it in the constructor without troubling the code that reads the file etc.

/J\