in reply to Question about loops and breaking out of them properly

> and in any case I wouldn't try to affect a grep or map with those control keywords.

It's documented in next

> "It should not be used to exit a grep or map operation."

Tho it's a bit inconsistent, because return clarifies that those grep/map blocks are special, but doesn't discourage the use.

> Returns from a subroutine, eval, do FILE, sort block or regex eval block (but not a grep, map, or do BLOCK block) with the value given in EXPR.

On a side note: I've never thought of using return inside a sort block and can't remember ever seeing it.

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

Update

So I tried it out in the debugger and next inside a grep block is doing exactly what I expected, it's ignoring grep and jumps to the next iteration of the surrounding loop. IOW

perl -de0 DB<12> for (1..9) {say grep {next if $_<5;$_%2} $_..9} 579 79 79 9 9

PS: yes it's a convoluted example.