title: Perl script giving un predictable results
body: <p>I am very new to Perl. I wrote a script to display user name from <strong>Linux</strong> passwd file. 
  It displays list of user name but then it also display user ids (which I am not trying to display at the moment) and at the end it displays "List of users ids and names:" which it should display before displaying list of names.
  Any idea why it is behaving like this?</p>
  
  <pre><code> #!/usr/bin/perl
   @names=system("cat /etc/passwd | cut -f 1 -d :");
   @ids=system("cat /etc/passwd | cut -f 3 -d :");
   $length=@ids;
   $i=0;
   print "List of users ids and names:\n";
   while ($i &lt; $length) {
      print $names[$i];
      $i +=1;
   }
  </code></pre>