in reply to Re^2: next'ing out of a "foreach" loop within a subroutine
in thread next'ing out of a "foreach" loop within a subroutine

So the "last" ends the foreach loop since a subroutine returns by default the result of the last operation right?
No. If you use next or last to exit a subroutine, the subroutine doesn't return a value; the next code to execute will a new iteration of the loop or the code after the loop, not the code receiving whatever the sub would have returned if it had returned.
  • Comment on Re^3: next'ing out of a "foreach" loop within a subroutine