Purcell, Scott wrote, on Tuesday, February 20, 2001 12:46
: Is there anyway to grep on a readdir handle and only get the directories,
: not any files?
:
: eg.
: open (SOMEDIRHANDLE, "$pathToDirectory") or die ("Problems opening
: $pathToDirectory. $!");
: my @directories = grep /-d/, readdir SOMEDIRHANDLE;
: closedir SOMEDIRHANDLE;
:
: That -d does NOT work, I get the following error:
: Can't declare pattern match at the file and line number of the above.

-d should not be in a pattern.

How about

my @directories = grep {!/^\./ && -d} readdir SOMEDIRHANDLE;

Joe

==============================================================
          Joseph P. Discenza, Sr. Programmer/Analyst
               mailto:[EMAIL PROTECTED]

          Carleton Inc.   http://www.carletoninc.com
          219.243.6040 ext. 300    fax: 219.243.6060

Providing Financial Solutions and Compliance for over 30 Years

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to