On Tue, 1 Oct 2002, Michael Fowler wrote: > While this works, typically the way I do it is something along the lines of: > > usage("Specify a directory to scan ...\n") unless defined $directory; > usage("Provide a comment for the ...\n") unless defined $comment; > > and so on, where usage() is a subroutine that will print out the message > specified, as well as some basic usage information. > > The point being, you don't have to test the variables multiple times. There > is a disadvantage in that the errors will not all be printed out if there > are multiple problems.
Thanks! I set-out to streamline the lenthy error checking/reporting and settled on this: <CODE> my $err; $err .= "Error message #1\n" unless (defined $one); $err .= "Error message #2\n" unless (defined $two and $two eq 'foo'); $err .= "Error message #3\n" unless (defined $three and $three > 50); die "$err" if $err; </CODE> -- Eric P. Sunnyvale, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]