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_line
14 >= and change the value of 3 (which is fixed here) I will get different counts. Therefore by each change at value of current_line
14 >= 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++;
}
}
}
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.