opendir doesnt NEED an or die.
$ perl -wMstrict -le 'opendir FOO, "/FOOBAR"; my @x = readdir FOO' readdir() attempted on invalid dirhandle FOO at -e line 1.

Also, what if the directory is inaccessible, etc... debugging code that doesn't check opendir et al for errors isn't fun. (Note autodie can be useful in addition to Use strict and warnings.)

I'm guessing that he ... entered them correctly. ... I nver trust user input, I try to check it where I can.

?

The regular expression is there in case there are any blank lines in the directory.txt file

Just that the regex will also skip files named, for example, 0_0. Probably better to just check the length.


In reply to Re^4: pushing file counts for adding by Anonymous Monk
in thread pushing file counts for adding by flieckster

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.