Karyn Williams wrote:
At 07:42 AM 6/15/05 -0700, you wrote:
Karyn Williams wrote:
Also,
there are just a handful of files BUT they are ever changing, so I would
like to not list the statically in the code.
but this would work:
chomp( my @lists = qx(ls /usr/local/dir) );
But this would work a lot better:
my @lists = glob '/usr/local/dir/*';
I added the glob and it worked great. However, I need to restrict @lists to
include only files that do not have extensions. I have been playing around
with this trying variations on glob and just plain regexes. i.e.
chomp( my @lists = '/usr/local/majordomo/lists/*[^(\.config|\.bak)]');
chomp( my @lists = "/usr/local/majordomo/lists/*[^(\.config|\.bak)]");
chomp( my @lists = qx(ls -A1
/usr/local/majordomo/lists/*[^(\.config|\.bak)]));
chomp( my @lists = qx(ls -A1 /usr/local/majordomo/lists/(.*(?=[^.])));
chomp( my @lists = "/usr/local/majordomo/lists/\w+(?=[^.])");
my @lists = glob '/usr/local/majordomo/lists/*[^(\.config|\.bak)]';
but I am not getting anywhere. Perl 5.6.1 on Solaris. Am I even close ?
As you have found out you can't use regular expressions in a file glob however
this should do what you want:
my @lists = grep m!/[^/.]+$!, glob '/usr/local/dir/*';
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>