title: perl my variable $x masks earlier declaration in same statement
body: <p>I am confused on this error, this program takes user input 1 2 3 2 and displays the input in a <em>specific order</em>.</p>
  
  <pre><code>#!/usr/bin/perl -w
  use strict;
  use warnings;
  
  print "Enter a number :";
  
  my $num = &lt;STDIN&gt;;
  chomp($num);
  
  my @final = split(' ',$num);
  my @count;
  foreach my $x (@final){
  
   $count[my $x]++;
  
  }
  foreach my $x (@count){
  
  print my $x .$count[my $x];
  }
  </code></pre>
  
  <p>my output : I get this error 
  <strong>"my" variable $x masks earlier declaration in same statement at line 19</strong></p>
  
  <p>Expected output:</p>
  
  <ul>
  <li>1 1</li>
  <li>2 2</li>
  <li>3 1</li>
  </ul>