SPUG:Best One-Liners and Scripts for UNIX

SPUG-list-owner tim at consultix-inc.com
Sun Apr 20 15:47:31 CDT 2003


On Sun, Apr 20, 2003 at 11:55:20AM -0700, Brian Hatch wrote:
> 
> However this is best used when the default or desired thing
> is on the left.  
> 
> 	die if something_very_unusual_happened
> 
> is bad form, instead you should stick to
> 
> 	if something_very_unusual_happened {
> 		die

I agree completely, and seeing lots of violations of this principle is
one of the reasons I generally counsel against the backwards style. I've
often wasted time reading and trying to comprehend a large chunk of
complicated code only to see "if $leapyear" at the end! 8-}

-Tim
*------------------------------------------------------------*
|  Tim Maher (206) 781-UNIX  (866) DOC-PERL  (866) DOC-UNIX  |
|  CEO, JAWCAR ("Just Another White Camel Award Recipient")  |
|  tim at Consultix-Inc.Com  TeachMeUnix.Com  TeachMePerl.Com   |
*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-*
|  Watch for my  Book: "Minimal Perl for Shell Programmers"  |
*------------------------------------------------------------*



More information about the spug-list mailing list