in reply to Regex and perl directories question
Maybe, although short, grep is not the best way to do this.#!/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"};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regex and perl directories question
by bryanj21 (Initiate) on Nov 20, 2001 at 04:48 UTC |