hurricup has asked for the wisdom of the Perl Monks concerning the following question:
Perldoc says pretty same for them, like
next cannot be used to exit a block which returns a value such as eval {} , sub {} , or do {} , and should not be used to exit a grep or map operation.
I read cannot as doesn't work. But. In some modules, like Par::Dist I can see code like:
File::Find::find( sub { next unless $File::Find::name; (-r && !-d) and push ( @files, substr($File::Find::name, 5) ); } , 'blib' );
What is it? Outdated documentation? Do I get cannot wrong way? Some tricky next, like sub?
Also, TIL, missing in docs, that last/next/redo may be used in statement modifiers, like say $_ and last for 1,2,3
I'm working on new code inspection, so question is not rythorical.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: last/next/redo usages
by haukex (Archbishop) on Mar 20, 2018 at 20:36 UTC | |
by hurricup (Pilgrim) on Mar 21, 2018 at 05:30 UTC | |
|
Re: last/next/redo usages
by LanX (Saint) on Mar 20, 2018 at 23:32 UTC | |
|
Re: last/next/redo usages
by stevieb (Canon) on Mar 22, 2018 at 01:17 UTC | |
by hurricup (Pilgrim) on Mar 22, 2018 at 08:24 UTC | |
by stevieb (Canon) on Mar 22, 2018 at 23:22 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |