This glob thing is just a mess. Part of the reason is the spaces that are allowed in some Windows file systems as you have noted! Youch! I beat the doo-doo out of an Active State app trying to get glob to work. Some of the modules worked with DOS glob and some with BSD glob.  use File::Glob 'glob'; is not a magic cure all. This BSD vs Sys V thing is weirder to understand. Anyway, I've spent many hours in "glob hell" and I just don't do it anymore.

Yes, closedir is the "right thing to do"! Every file handle comes from a limited pool of system resources. For a 20 line program, I don't worry about it much, but as they say "your mileage may vary". If this 20 line thing is in a client-server app, well then an open file handle here and there adds up! And the application bombs!

I tutor some students at a local college and one fundamental mistake is lack of whitespace and separating "thought units", but you see that too!

I have ammended my evil 'C' ways in favor of lining up braces. I am quite sure that this is the best way and I don't understand why you don't think that it is.

Anyway I say Horray! The OP has some good code to work from and I think he/she will do a great job!


In reply to Re^4: Writing to file... by Marshall
in thread Writing to file... by perl_n00b

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.