http://qs1969.pair.com?node_id=608557

sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:

While coding something today I came across an interesting question regarding coding styles. Say you have a test you need done in which, when successful/unsuccessful, you exit the script completely AND after that test is done, you do something else.

Easier asked with an example, I s'pose.

my $name = param("name"); if ($name eq "") { print qq(Sorry, name can't be empty); exit; } print "Thank you, $name. Your submission is complete.";
How many of you exclude the else clause in the above situation?
if ($name eq "") { print qq(Sorry, name can't be empty); exit; } else { print "Thank you, $name. Your submission is complete."; }
Can anyone think of a reason why the first example could be a bad idea under given circumstances? I can't see how either would be better or worse, but am curious to see how you guys would perform simple tests like this.


"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid