Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: perl script to print just directory names

by 2teez (Priest)
on Dec 06, 2012 at 21:19 UTC ( #1007656=note: print w/ replies, xml ) Need Help??

in reply to perl script to print just directory names

Hi Vijaay81,
As previously mentioned by toolic and others post before this. I also support using the module File::Find, which could reduce the number of lines of codes you write by half, if not more.
Something like so:

use strict; use warnings; use File::Find; find( sub { return if $_ eq '.' or $_ eq '..'; print $_, $/ if -d }, ' +.' ); #OR my @dir; find( sub { return if $_ eq '.' or $_ eq '..'; if (-d) { print $_, $/; # just to test push @dir, $_; # updated } }, '.' # this can be your "C:\Input" ); use DDP; p @dir;
Please, you would need module Data::Printer, installed for this line use DDP; p @dir; to work.
Hope this helps.

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Comment on Re: perl script to print just directory names
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2016-02-12 15:18 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (404 votes), past polls