in reply to Re: get contents of directory
in thread get contents of directory

This may be slightly off topic, it sounds to me you're creating something similar to a MANIFEST file. Let me explain what this is..

On CPAN, every module has a file in it called MANIFEST. It's become a standard part of most perl module distributions. Basically, it's is a list of all the files in the current (and lower directories), along with optional comments beside each file name. It's main purpose is to be a module-wide database of required files, so that during install, any missing files will immediately raise errors from the install process.

There is a module called ExtUtils::Manifest, which is part of the standard perl distribution, that takes care of reading the current directory, and creating a MANIFEST file for you. As well, inside a file called MANIFEST.SKIP, you can specify a list of regexes that match file names to skip.

While it's interface it's very elegant, it is functional, and may give you ideas if/when you decide to roll your own manifest writer. Here's some simple example code that will create a MANIFEST with the current directories' contents inside it:

#!/usr/bin/perl -w use ExtUtils::Manifest qw(mkmanifest); #Optional Configuration $ExtUtils::Manifest::Quiet = 1; #Turn off warnings $ExtUtils::Manifest::Verbose = 0; #Turn off status updates $ExtUtils::Manifest::MANIFEST = 'MANIFEST'; #Filename to write #Will make a MANIFEST file for all the files in your #current directory, including the MANIFEST file mkmanifest();