in reply to exit calling subroutine

Thank you all for the replies.

you could stick a loop around the whole thing and call next in the subroutine instead of return

I tried exactly that but it didn't work, complaining that it couldn't find the label.

LABEL: { sub outer { inner(); } sub inner { next LABEL; } }
use strict; use warnings; print "Just Another Perl Hacker\n";

Replies are listed 'Best First'.
Re^2: exit calling subroutine
by Anonymous Monk on Jan 10, 2008 at 15:52 UTC
    C:\@Work\Perl>perl -wMstrict -e "LABEL: { outer(); } sub outer { print qq(in outer() before inner() \n); inner(); print qq(in outer() after inner() \n); } sub inner { print qq(in inner() \n); no warnings; next; }" in outer() before inner() in inner() C:\@Work\Perl>perl -wMstrict -e "LABEL: { outer(); } sub outer { print qq(in outer() before inner() \n); inner(); print qq(in outer() after inner() \n); } sub inner { print qq(in inner() \n); no warnings; ; }" in outer() before inner() in inner() in outer() after inner()