title: Why is my Perl loop off by one at the end?
body: <p>I have this program which does not work as expected. Help me.</p>
  
  <p>I want to print a row heading.</p>
  
  <p>If input is <code>4</code>, I want <code>1|2|3|4</code> to be output.</p>
  
  <p>It does not work as all, if I hard-code <code>$count</code> value it works partially but the last number is missing.</p>
  
  <pre><code>sub printC {
          my $count = @_;
          # count = 4  # works partially only prints 1|2|3
          for(my $i=1;$i&lt;$count;$i++) {
                  print "$i|";
          }
          print $i;
  }
  $count  = 2;
  &amp;printC($count);
  print "\n";
  </code></pre>