in reply to File handles in an object

In the absence of a bigger picture here, I'll throw out the tasty little tidbit that you can actually bless a typeglob into an object. You'll have to use the Symbol package (to get at gensym), but you can do some surprisingly nifty things with it:
#!/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>); }
Here's some code to test this:
package main; my $fileread = GlobPack->new('globpack.pl') || die "Can't get the glob +ject.\n"; $fileread->read();