this is a minimal working example of how to skip iterations within a list of numbers:
#!/usr/bin/env perl
use strict;
use feature 'say';
use warnings FATAL => 'all';
use autodie ':default';
foreach my $n (0..29) {
if ($n % 4 == 0) {
$n += 5; # goes to $n+1, even though I increased $n to $n+5
next;
}
say $n;
}
I cannot alter $n
so that it jumps several iterations within the number.
That is, I want next
to move 5 up, not 1.
How can I skip multiple iterations of a foreach loop?