Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Format Style Opinions: my, ternary, subroutine

by gamache (Friar)
on Dec 04, 2007 at 17:35 UTC ( [id://654879] : note . print w/replies, xml ) Need Help??

in reply to Format / Logical Expression / Style Opinions: my, ternary, subroutine, @_

I know Damian Conway gives this advice on PBP page 31, but he still can't make me like nested ternaries. If you're going to use his style, I suggest lining up the croak with the (undef, @_) and @_. Your code is readable, in any case.

It is considered bad form to use a ternary structure to do things other than return a single value, in general, but I don't mind your use of croak as the "if all else fails" condition. (Update: I later saw this in PBP as well, on page 258 to be exact.)