Keep It Simple, Stupid | |
PerlMonks |
Re: finding intermediate range values from two file columnsby choroba (Cardinal) |
on Aug 09, 2016 at 21:03 UTC ( [id://1169437]=note: print w/replies, xml ) | Need Help?? |
As perldigious noted, your sample input and output don't make sense. I modified the input in the following way:
And got the following result:
from the following code:
Explanation: @ranges is an array of arrays, it stores the ranges from the first file. While processing the second file, you remember the last range(1) used ( $range_idx ) and for input ranges(2) spreading over more than one range(1), you adjust the $from and try again. Joining the b's and c's left as an exercise for the reader :-)
In Section
Seekers of Perl Wisdom
|
|