I see that you are a Windows user. If you are going to use that first line, "#! perl -w scipt", it should look like this: #!/usr/bin/perl -w. On Unix this says to run the program at /usr/bin/perl (ie Perl) with the -w option. On Windows, this path is ignored and Windows only uses the -w option. This takes the place of "use warnings;" in the code.

I am just going from this comment:
# find all the subdirectories of a given directory.

Before learning about fancy modules, I would recommend learning the basics. The code that you need is not hard.

#!/usr/bin/perl -w use strict; use File::Find; my $start_dir = "C:/"; find (\&print_all_directories, "$start_dir"); sub print_all_directories { return if !-d; my $full_dir_path = $File::Find::name; print "$full_dir_path\n"; }
find()in module File::Find, visits all files below the directory specified, calling the specified subroutine on each file. A directory is also a file! If the file isn't a directory, print_all_directories() just returns, if this is a directory, we figure out the full path name and print it.

In reply to Re: use File::Find::Rule by Marshall
in thread use File::Find::Rule by Win

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.