Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: extract relevent lines according to array

by Skeeve (Vicar)
on Apr 19, 2010 at 14:47 UTC ( #835501=note: print w/replies, xml ) Need Help??


in reply to extract relevent lines according to array

$chrom='chr1'; $start=9839; $stop=9841; while (<DATA>) { if (/variableStep chrom=$chrom/ ... /variableStep chrom/) { if (/^$start\b/ .. /^$stop\b/) { chomp; push @result, (split ' ',$_,2)[1]; } } } use Data::Dumper; print Dumper \@result; __DATA__ variableStep chrom=chr1 9837 0.010 9838 0.008 9839 0.007 9840 0.004 9841 0.002 9842 0.001 variableStep chrom=chr2 9837 0.090 9838 0.038 9839 0.017 9840 0.044 9841 0.052 9842 0.091

s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://835501]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2016-09-24 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (462 votes). Check out past polls.