I'm currently writing a module named
FileSystemObjects::Directoy. It's Beta but most features seem to be stable. I have not put it to CPAN yet, because I discovered Path::Class which has similar features and want to examine it's code before. Anyway, with
FileSystemObjects::Directoy you could write your code like
use FileSystemObjects::Directory;
#...
for ( @path )
{
my $dir = FileSystemObjects::Directory->new ($_);
for ( $dir->files (mask => '*.txt') )
{
print $_->name, " / ", $_->size, "\n";
}
I can post it's code here if you volunteer to test it.