But unless you have done a chdir it will only pass the file name or
directory name and not do what you want.

Wags ;)

-----Original Message-----
From: Felix Geerinckx [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 20, 2002 15:31
To: [EMAIL PROTECTED]
Subject: Re: filter list of files from directory into array


on Thu, 20 Jun 2002 22:03:04 GMT,  wrote:

> 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. 
> 
> [...] 
> my @filelist = grep { $_ ne -d && m/^\d\d\d(\d|\d\d)\d$/ }, readdir
> DIR; 

Try this:

     my @filelist = grep { -f && m/^\d{5,6}$/}  readdir DIR;

the '-f' test (by default on $_) means 'normal file'.
I also simplified the regex by using the '\d{min,max}' notation.

See
        perldoc -f -X
        perldoc perlre

-- 
felix

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

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

Reply via email to