On Wed, Jul 21, 2010 at 6:18 AM, Mimi Cafe <mimic...@googlemail.com> wrote:
> If my program will continue to evaluate the rest of the program, then is it > efficient to call exit one time at the end of the program or call exit as > the last line of each subroutine to ensure the program ends there? > "Efficient" doesn't offer a lot of benefit at this point in the program. The difference is fractions of a microsecond. "Readable" will help you more in the long term. My personal rule of thumb says that exiting belongs in the main application. Ending the application is not integral to the actions "foo" or "bar". I assume that from the description - you don't care which subroutine runs, the program should exit after any of them. So I would exit from the main program. Maybe something like this... If ($foo){ my_sub_foo(); # Is the program going to continue from here once sub foo has ended and I have not called exit here or in the sub? } elsif ($bar){ my_sub_bar(); } else { my_other_sub(); } exit 0; -- Robert Wohlfarth