title: Simple way to read variables on different lines from STDIN?
body: <p>I want to read two integers on two lines like:</p>
  
  <pre><code>4
  5
  </code></pre>
  
  <p>This code works:</p>
  
  <pre><code>fscanf(STDIN,"%d",$num);
  fscanf(STDIN,"%d",$v);
  </code></pre>
  
  <p>But I wonder if there's a shorter way to write this? (For more variables, I don't want to write a statement for each variable) Like:</p>
  
  <pre><code>//The following two lines leaves the second variable to be NULL
  fscanf(STDIN,"%d%d",$num,$v);
  fscanf(STDIN,"%d\n%d",$num,$v);
  </code></pre>
  
  <p><strong>Update:</strong> I solved this using the method provided in the answer to read an array and <code>list</code> to assign variables from an array.</p>