in reply to Re: Hash making
in thread Hash making

Thanks Friedo,

I think was not clear enough. I just put $mismatch = 3 to test if I can create a loop. So at each $mismatch, I will have a series of line extracted let's say 1000000 for $mismatch =1.

Then when mismatch changes to 2, another set of lines will be extracted. let's say 700000.

The goal is to have has with keys = different $mismatches and values number of lines extracted.

Any further help is appreciated.

Replies are listed 'Best First'.
Re^3: Hash making
by ikegami (Patriarch) on Sep 21, 2008 at 05:28 UTC

    So at each $mismatch

    I don't understand "being at a variable".

    I will have a series of line extracted let's say 1000000 for $mismatch =1.

    How do you determine how many lines to extract?

    Then when mismatch changes to 2, another set of lines will be extracted. let's say 700000.

    What causes $mismatch to change?

    I will have a series of line extracted

    I don't understand "extracting a line". Do you mean "reading a line"? What do with the lines you've extracted?

      Let's look at the following code. Up to counter1++ and forget the rest for now. with the conditions set (unless), I am taking those lines that are qualified. Counter1 gives me the number of counts for those lines (value for a hash). If I can iterate through $current_line14 >= and change the value of 3 (which is fixed here) I will get different counts. Therefore by each change at value of current_line14 >= you will get a different count. So your hash keys become your loop values from 3..30 for example and values will be the number of lines extracted. If I want to change "3" manually I have to perform the while loop 20 - 30 times for each key in order to get the counts.
      while(<INPUT2>){ chomp; my @current_line = split /\t/; # eliminate unqualified lines early next unless $current_line[5] == 1 && $current_line[14] >= 3; $counter1++; if ($file1{ $current_line[1]}) { my ($from, $to) = @{ $file1{ $current_line[1] } }; for ($from <= $current_line[2] && $current_line[2] <= $to) { print join("\t", $current_line[1],$current_line[5],$current_line[14 +], "***",$current_line[2]), "\n"; $lines++; } } }

        Don't speak in terms of your code (which is broken), speak in terms of your inputs (of which you haven't even shown a sample).

        I might find an answer to some of my questions in what you posted if I ponder long enough, but I'm more likely to come up with more questions than answers. Why do you think you can express yourself better in Perl than in English.

        In short, I'm still waiting for answers to my questions. Or feel free to start over while avoiding posting code.