Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
you can also use File::Find (as i've recently found)

something like: (i've not tested this!)

my @found; File::Find::find({wanted => \&wanted], '.'); sub wanted { if (-d $_) && ($_ != '.') && ($_ != '..') { push(@found, $_) } }
sure, this is not the fastest way (someone on the above referenced node timed the native find vs File::Find, with native winning by a factor of 5), but it's a way.

also, be careful of the greps to remove the . and .. entries... it's legal to have directories that start with a period (or two, or more), so you have to do an exact match on both cases.

(i think)

i too am a newbie here, and i've been thanking people...
hopefully, i can provide some answers myself one day.

(ps: please forgive the expanded syntax, but it's (to my unPerlish eye) easier to read!)


In reply to Re: Re: Create a list of directories without . and .. by u914
in thread Create a list of directories without . and .. by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-18 08:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found