Probably better off using opendir and readdir. They're built into Perl and
you don't need to launch another child process to get the results you want.
This worked for me, and should work on Windoze or *NIX. I created 4
directories: DMAR, DMAX, BFMAR, BFMAX.

#########################################################################
#!C:\Perl\bin\perl.exe

my $dir = 'C:\Documents and Settings\SRobnet\Desktop';
my @ary = ();
opendir(MYDIRECTORY, $dir) or die "Can\'t open directory $dir: $!";
@ary = grep { (/^DMA/)||(/^BFMA/) && -d "$dir/$_" } readdir(MYDIRECTORY);
closedir(MYDIRECTORY);

foreach my $item(@ary) {
 print $item . "\n";
}

1;
#########################################################################

Results:

C:\Documents and Settings\SRobnet\Desktop>perl dir.pl
DMAR
DMAX
BFMAR
BFMAX

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to