[Pdx-pm] sub calling logic

Randall Hansen perl at sonofhans.net
Tue Dec 16 14:36:52 CST 2003


On Dec 16, 2003, at 12:11, Roderick A. Anderson wrote:

> sub doit {
>
> 	if (something) {
> 	      ...
> 	} else {
> 	      return;
> 	}
> }

This looks fine to me.  Especially if you're potentially "doing it" 
more than once, you've reduced the amount of code and left yourself 
only one bit of logic to debug.

Here's another way to write that sub:

sub doit {
	return unless [something];
	...
}

HTH

randall




More information about the Pdx-pm-list mailing list