in reply to Regex and perl directories question

Something like this, I think:
#!/usr/bin/perl my @dirs; my $sth; my $gt; my $dir = '/home/vendors/test/public_html'; opendir D,$dir or die $! chdir $dir; @dirs=grep{-d} readdir D; closedir D; foreach (sort @dirs) {print "$_\n"};
Maybe, although short, grep is not the best way to do this.
(# my @dirs = grep (-d, readdir D); # would work just as well, of course).
mkmcconn

Replies are listed 'Best First'.
Re: Re: Regex and perl directories question
by bryanj21 (Initiate) on Nov 20, 2001 at 04:48 UTC
    Thanks for your help!

    bjdevil