in reply to last/next/redo usages
Good question where it's documented, but yes, it is possible, although it warns:
use warnings; use strict; use diagnostics; sub foo { last if /e/; next if /c/; redo if s/b/B/ } my @x = qw/a b c d e f/; for (@x) { foo; print "$_\n"; } __END__ a Exiting subroutine via redo at test.pl line 6 (#1) (W exiting) You are exiting a subroutine by unconventional means, +such as a goto, or a loop control statement. B Exiting subroutine via next at test.pl line 6 (#1) d Exiting subroutine via last at test.pl line 6 (#1)
Update: See also e.g. Exiting subroutine via next
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: last/next/redo usages
by hurricup (Pilgrim) on Mar 21, 2018 at 05:30 UTC |