I am new to perl I want to count the occurance of gene ID's in a file like under; I simply want to count how many Glyma05g00620.1|PACid:16257864 etc are these in my file.

@SQ SN:Glyma0095s00250.1|PACid:16242825 LN:445 @SQ SN:Glyma0142s00240.1|PACid:16242871 LN:472 @PG ID:Bowtie VN:0.12.6 CL:"./bowtie --best --sam Gmax /Users +/waseem/Desktop/inputdata/s_4_sequence_S21A.txt /Users/waseem/Desktop +/Outputs/s_4_sequence_S21Aoutput.sam" DBRHHJN1_0134:4:1:1203:1044#ATCACG/1 16 Glyma05g00620.1|PACid:16 +257864 324 255 100M * 0 0 CGCCGACATCTCGGGGCTCACC +CCATGCAAGGAGTCGAAGCAGTTCGCGAAGCGTGAGAAGCAGTCGATAAAGAAGCTGGAGTCGTCGCTG +AAGCTCCAC BBBBBBBB`dcceeeddcc\cccc`ZbabYedaddadeceb_bc^^eaggdgddbg +ggeegggggeggggggggggfgggeggggggegggggggggggg XA:i:1 MD:Z:97T2 + NM:i:1 DBRHHJN1_0134:4:1:1808:1025#ATCACG/1 16 Glyma12g03760.1|PACid:16 +286293 1740 255 100M * 0 0 TAATAAATGGACATCACTGGC +CTTAATGGTGTATCGTGAAACAATTGAAGCCGGTGGAAAACCTACAAGTGAAATATTACCACAAATTCT +GGGATGCCTG BBBB__YT]OY]]M\Yccc`\]`Za[Vda``[dbdeb]febec^e_^gggffffd +gggggggggggggggffffffggeggggggggfggggggggfggg

In reply to How to make a Counter by alvi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.