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

You could do this if you just want less typing:

foreach my $i ( $from .. $to ) { next if ($i % 2 || $i % 3 || $i % 4 || $i % 5); say $i; }

Or did you want some programmatic way to represent the range of mod arguments?