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]