title: How can I print only the even numbered lines of an array in perl?
body: <p>I am new to Perl and am trying to write a script that will only print the even numbered lines of an array. I have tried multiple different methods of finding the size to use as the condition for my while loop, but I always end up getting an infinite loop of the first line without the program terminating. The array being input is a text file, input with the form "program.pl &lt; foo.txt". Have I made a logic or syntax error?</p>
  
  <pre><code>@input = &lt;STDIN&gt;;
  $i = $1;
  $size = $#input + $1;
  while ($size &gt;= $i) {
          print "$input[$i]";
          $i = ($i + $2);
  }
  </code></pre>