title: get unique values using perl
body: <p>I have a data frame like this</p>
  
  <pre><code>val gene
  1 Bra011877
  1 Bra011878
  1 Bra011767
  1 Bra011766
  1 Bra011765
  2 Bra011743
  1 Bra011766
  1 Bra011742
  1 Bra011669
  1 Bra011670
  1 Bra011767
  </code></pre>
  
  <p>What i want is to get the number of unique values for each of the corresponding gene like this without sorting the table.</p>
  
  <pre><code>val gene
  1 Bra011877
  1 Bra011878
  2 Bra011767
  1 Bra011766
  1 Bra011765
  2 Bra011743
  1 Bra011766
  1 Bra011742
  1 Bra011669
  1 Bra011670
  </code></pre>
  
  <p>Can somebody help?</p>
  
  <p>Thanks
  Upendra</p>