unmatched has asked for the wisdom of the Perl Monks concerning the following question:
Hello, Monks!
I come seeking your wisdom once more. Today, the question that I have is a simple matter of loops and how they work when they happen within functions such as grep.
This is my code:
for my $component ( split(/,/, $components_csv) ) { if (grep { $_ eq $component } @url_components) { push( @selected_components, $component); next; } # ... }
In this example, the next keyword: would take me to the next iteration of grep, or to the next iteration of the outer for loop? I could use a label to handle this, but I'm not sure if I need to.
Thank you, cheers.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Question about loops and breaking out of them properly (updated)
by haukex (Archbishop) on Apr 18, 2025 at 11:18 UTC | |
by Fletch (Bishop) on Apr 18, 2025 at 13:48 UTC | |
by unmatched (Sexton) on Apr 19, 2025 at 09:54 UTC | |
by unmatched (Sexton) on Apr 18, 2025 at 12:54 UTC | |
by haukex (Archbishop) on Apr 18, 2025 at 13:47 UTC | |
Re: Question about loops and breaking out of them properly
by ikegami (Patriarch) on Apr 18, 2025 at 23:25 UTC | |
Re: Question about loops and breaking out of them properly
by LanX (Saint) on Apr 18, 2025 at 21:57 UTC |