hello umaykulsum

As you do not ask for something nor point to particular errors i can only guess:

first i cannot understand how your data sample can be splitted using \t\s pattern (ah ok you are setting $/ for this..).

second i do not see where you are opening files (maybe the script is run under -nl ?)

If each file just contains 2 lines you can simply do:

my $key = <$filehandle>; # first line my $value = <$filehandle>; # second line

You also have no need to iterate over an array to get the count: @array in scalar context returns the numbers of elements. Also $#array contains the index of the last element ( so $#array + 1 == scalar @array ).

You also want the name of the file to be preserved somehow: you can read about $ARGV or you must create a sub that given the filename as arg, open it process it and store the filename along results.

A pray to you and to ALL BIONFORMATICS here around: sample data can be AGATC instead of a line of hundreds of chars? have readable data as sample help my eyes a lot!

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

In reply to Re: count total number of occurrence in all files by Discipulus
in thread Reaped: count total number of occurrence in all files by NodeReaper

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.