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?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; } } }
In reply to Re^2: Loop stops at first iteration
by props
in thread Loop stops at first iteration
by props
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |