let's unfold my brain thoughts: i did some minor changes from previous code:
foreach my $folder (@folders) { # for instance folder1 next if ($folder eq "."); next if ($folder eq ".."); my $fqname = catdir( $output, $folder ); #$fqname is /mnt/music/output/folder1 if ( -d $fqname ) { #passed the test if (glob("$fqname/*.cue")) { # yes there is /mnt/music/found/output/folder1/a.cue print "$fqname: cue found\n"; #prints: /mnt/music/found/output/folder1/: cue found my ($cue) = <$fqname/*.cue>; # my ($cue) grabs /mnt/music/output/folder1/a.cue } elsif(!glob(("fqname/*.cue"))) { print "$fqname: no cue found\n"; next; } } }
I understand that every loop grabs one element in the @folder array and executes the subroutine. Each iteration is unique and it doesn't have to remember the previous executions. my ($cue) = <$fqname/*.cue>; gets a different cue file on every iteration. Now if it has to do with the context of glob and I push @cues , ($cue) i will have an array of cue files in @cues. So how i will be helped by this approach?

In reply to Re^2: Loop stops at first iteration by props
in thread Loop stops at first iteration by props

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.