title: How to generate an array with a counter in Perl?
body: <p>I want to generate a list of <strong>unique</strong> IDs. Because some of the IDs are duplicates, I need to add a number at the end to make them unique, like so:</p>
  
  <p>ID=exon00001 <br>
  ID=exon00002 <br>
  ID=exon00003 <br>
  ID=exon00004</p>
  
  <p>Here's what I have so far.</p>
  
  <pre><code> while (loop through the IDs) {
   # if $id is an exon, then increment the counter by one and add it 
   # to the end of the ID
      if ($id =~ m/exon/) {
      my $exon_count = 0;
      my @exon = $exon_count++; #3
      $number = pop @exon; # removes the first element of the list
      $id = $id.$number;
      print $id."/n"
      }
      }
  </code></pre>
  
  <p>Basically I want to dynamically generate an array with a counter. It's supposed to create an array (1, 2, 3, 4, ... ) for the total number of exons, then remove the elements and add it to the string. This code doesn't work properly. I think there's something wrong with line #3. Do you guys know? Any ideas? thank you</p>