title: Perl customized sort
body: <p>I would like to sort an array and put particular element to the beginning.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>sub MySort {
      my $P = 'node';
      if ($a eq $P) {
          return -1;
      }
  
      return -1 if $a lt $b;
      return 0  if $a eq $b;
      return 1  if $a gt $b;
  }
  
  my @x = qw (abc def xxx yyy ggg mmm node);
  print join "\n",sort MySort @x
  </code></pre>
  
  <p>I expect "node" go to the beginning but it's not working.</p>
  
  <p>Result:</p>
  
  <pre><code>abc
  def
  ggg
  node
  mmm
  xxx
  yyy
  </code></pre>
  
  <p>Expected Result:</p>
  
  <pre><code>node
  abc
  def
  ggg
  mmm
  xxx
  yyy
  </code></pre>