Here's a topic for discussion:

Coming from C++-land, I've always been taught over and over again that all 
subroutines/functions/blocks/etc should have only a single entry point and 
a single exit point.  "It's just good programming practice."  But now in 
the world of Perl, I've observed that a "Perl-ish" thing to do is to place 
multiple return/exit/etc statements in certain blocks of code or in 
conditional blocks.  (Then again, maybe it isn't Perl-ish, but I've had to 
sort through many perl scripts like this.)

I guess I'm just curious to know what other more experienced Perl 
programmers think about this.  I still adhere strictly to the "one way in, 
one way out" philosophy, mainly for the sake of readability.  But I 
understand how much easier it can make a programmer's task to write 
something like "if (some condition) { exit; }"

Also, I was wondering if exiting prematurely like this from a program has 
any adverse affects on the execution of the program.

Thanks,
Kurt

Reply via email to