Though it has been described as only a PDP-11 assembler, C stands in a place of honor, surrounded by children, legitimate and illegitimate alike. The reason is very simple: C is not just a PDP-11 assembler. It simplified things by giving us the ternary operator.

At his last job, Frank realized that the magic of cond ? var_t : var_f is that it's not just an operator, it's a fundamental building block of other operators. Forget if then else and temporary variables! Some languages let you write cond && amp; var_t || var_f or statement if condition but that's just syntactic sugar.

From Frank,

At a previous employer many moons ago, there was a production, mission-critical system written as a bunch of multi-thousand line Perl scripts. I was hired to be part of a team which would take the most commonly used of these beasts and convert them into clean, efficient mod_perl applications with a proper template system and modular code. Of course, the original CGIs used global variables all over the place and thus couldn't be safely ported to mod_perl without significant refactoring.

 

It was during this project that he became enlightened, standing face to face with what he calls the "elevenary operator."

  my $send_button =
      ( !$rAuth->permits(SEND)
          ? ''
          :  $status != 1
              ? '' #'[Mailing must be unlocked to send now]'
              : $approved
                  ? $send_now
                      ? '' #'[Mailing in Progress]'
                          : qq(
                              <form action="schedule" method="POST">
                              <p align="center">
                              <input
                                  type="image"
                                  name="send"
                                  src="$::root/sendit.png"
                                  alt="Send"
                                  border="0"
                                  class="form-align"
                              >
                              </p>
                              <input
                                  type="hidden"
                                  name="state"
                                  value="$sh"
                              >
                              </form>
                          )
                      : $send_now
                          ? '' #'[Cancelling]'
                          : '' #'[Approval Required]' )
      );

 

Management was so happy that the mod_perl version ran in four seconds instead of thirty-four that they sang the praises of the development team as they fired them.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!