in reply to Coding styles using if/else
IMHO printing for an error message is bad practice, let a function or a module take care of it, and exit (or better yet die, or croak) with a code or a message.exit "Sorry, name can't be empty" if $name eq '' ; print "Thank you, $name. Your submission is complete.";
UPDATE
I didn't know exit() was CORE:: -- news to me. use die instead as said below, I thought this was a user func.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Coding styles using if/else
by shmem (Chancellor) on Apr 05, 2007 at 23:09 UTC | |
by bart (Canon) on Apr 06, 2007 at 18:02 UTC |