- In case you haven't noticed during your four months in the monastery: always use strict; use warnings;
- How would you do it if there's just one directory? Can you get that code working? (hint: it requires fixing compiler errors in your example, and then simplifying your glob statement.
- Do you know how to then add more entries into your array with a second line of code? (hint: there's builtin functions for appending and/or prepending a list of values to arrays: see perlfunc).
if steps 1-3 get it for you, great. If not, show the working code (SSCCE) for #2 and the failing code for #3, and explain what your thought process was, and why you tried what you tried. If you cannot even get #2, post your failing code, and include the errors you are getting.
(haukex made some good glob-specific points while I was writing this, before I posted, that are likely to get you to the solution, too. TIMTOWTDI, and what I've presented is the series of steps I would take to debug the problem, if were it mine: simplify to a single directory; expand to multiple directories using the simplest perl syntax you can come up with. I'd recommend going through those steps to improve your coding and debug skills, even if haukex's suggestion works for you.)
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.