in reply to Re^2: next in continue doesn't DWIM
in thread next in continue doesn't DWIM
For reason of retro compatibility, and the Principle Of Least Astonishment (well, talk about DWIM ...) when people are used to this behaviour, do not expect this to change. And there might be CPAN modules that rely on this feature, which would go broken if it changed. That's actually the first thing I was told here, because I asked about a possible change of regex syntax (oh foolish me).
Now as for a legitimate use of it ... I never saw one. But I guess it could for exemple be used to separate what should be done on all data samples and what should be only done on "valid data" like:
If process is what is important, and invalid samples are rare enough that you don't want to visually polute the main process, but you still have to deal with them this could a way to do it.
$data = init();
$data = getSample();
print $logfile "Input contained $data";
next if invalid($data);
Here is another example:
STATE: until ($state->name eq 'Ending')
redo STATE if nothingHasChanged();
$state = $state->nextState(context);
next STATE unless $blackList->contains($state); #here we want to go
+to the next state without processing the current one