#!/usr/bin/perl -w package GlobPack; use strict; use Symbol; sub new { my $class = shift; my $file = shift || "test.txt"; $class = ref($class) || $class; my $self = gensym; open($self, $file) || return undef; return bless ($self, $class); } sub read { my $self = shift; print while (<$self>); } #### package main; my $fileread = GlobPack->new('globpack.pl') || die "Can't get the globject.\n"; $fileread->read();