in reply to if ... elsif ... else

For completeness, here is a programmatic way:

OUTER: foreach my $i ( $from .. $to ) { for (2 .. 5) { next OUTER if $i % $_; } say $i; }

Replies are listed 'Best First'.
Re^2: if ... elsif ... else
by shmem (Chancellor) on Jun 01, 2017 at 10:12 UTC

    I would use a statement modifier here

    OUTER: foreach my $i ( $from .. $to ) { $i % $_ and next OUTER for 2 .. 5; say $i; }

    because it is more like natural language, and because I dislike both one-line-xxx(){...}-loops and multiline loops with just one statement in the loop body.

    But that's just a matter of taste or style ;-)

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'