Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: How do I find directories within directories using : parse_dir(`ls -l`)

by toolic (Bishop)
on Aug 15, 2009 at 18:14 UTC ( [id://788917]=note: print w/replies, xml ) Need Help??


in reply to How do I find directories within directories using : parse_dir(`ls -l`)

If you could use some other module, File::Slurp provides a read_dir function which can be used as follows.

read_dir returns a list of directory contents.

grep -d selects only directories (filtering out files).

use File::Slurp; my @dirs = grep { -d "$dir/$_" } read_dir($dir);

To include the . and .. special directories, add the keep_dot_dot option:

my @dirs = grep { -d "$dir/$_" } read_dir($dir, keep_dot_dot=>1);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://788917]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-25 23:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found