Hello List,

I am working on my first "real" Perl program.  I am using Active Perl 5.6 on
Windows NT/2000.  So far, I am just trying to read a directory of files into
an array, but only those files that are named with 5 or 6 numbers and no
extension, like 12345 or 654321.  I've got that part down except that I
don't know how to keep another directory out of that array.

###### start code ########
use warnings;
use strict;

opendir (DIR, "c:\\prod\\rej") || die "can't open c:\\prod\\rej: $!";
my @filelist = grep m/^\d\d\d(\d|\d\d)\d$/, readdir DIR;
print ("@filelist");
closedir DIR;
###### end code ########

This works great except it also includes a directory named 11113 that I
created under c:\prod\rej for testing purposes.  I was trying something like
this (don't laugh _too_ hard):

my @filelist = grep { $_ ne -d && m/^\d\d\d(\d|\d\d)\d$/ }, readdir DIR;

but then I would get this error:

syntax error at C:\perl\practice\test.pl line 5, near "},"
Execution of C:\perl\practice\test.pl aborted due to compilation errors.

How do I get that directory out of my array?  I would welcome any
suggestions/critique.

Thank you,
Rebecca



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to