title: Perl one-liner if else logic
body: <p>I'm evaluating whether or not certain variables match expected values.  The variables are set in memory by a certain program, the values of which can be access from the shell with a custom program. </p>
  
  <p>I'm piping the output of the shell command to awk to get the specific field I want and then I want to run it through perl to see if it matches the expected value.  For example,</p>
  
  <pre><code>ysgrp autostart | awk -F\: '{print $1}' | perl -e 'print {"True"} else {print "False"} if /on/'
  </code></pre>
  
  <p>However, I'm getting complaints from perl about compilation errors near "} else".  How does one handle if/then/else logic in a perl one-liner?</p>