Still very stuck on this one if anyone can provide more code/help it would be most appreciated.
Thanks
Dave
Hi
I have a parsing issue that I was wondering if someone can please help me out.
Thanks for your consideration
Dave
If I have a data file like below:
$start $stop $id1 $id2
1 100 1 2
101 200 1 2
201 300 1 0
301 400 1 0
401 500 0 2
501 600 0 2
601 700 0 0
701 800 1 1
801 900 1 2
I want to go down each column $id1 and $id2 and replacing the zeros '0' in a block of zeros with a number only if the number before and after the end zero blocks are the same, eg: the results would be:
1 100 1 2
101 200 1 2
201 300 1 2
301 400 1 2
401 500 1 2
501 600 1 2
601 700 1 0
701 800 1 1
801 900 1 2
here is some code I started off:
while(<>){
chomp;
($start, $stop, $id1, $id2)=split(/\t/,$_);
$old_id1=$id1;
$old_id2=$id2;
}
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.