The following snippet is not looping.
sub get_section { print join ':', @_ ; for (@_) { print ; /\.dat/ && do {$file = join '/', ($docdir, $_); $pubdate = substr ($_, 1, 4); print "$file \:\: $pubdate\n" ; @dat = get_file($file) ; sort_dat(@dat) ; print_sect() ; } ; } }
Looking at the above, and assuming that my dats are E0209.dat, F0210.dat, and H0211.dat, I get:
E0209.dat:F0210.dat:H0211.dat (First print statement)
E0209.dat (Second print statement)
/data/E0209.dat :: 0209 (End of loop)

Shouldn't the "for" take care of looking at every value in the array?? If not, I am without my Perl Refs and would appreciate a quick fix. Thanks, Hammy


In reply to Not looping... Am I a moron? by HamNRye

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.