Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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


Comment on Re: extract relevent lines according to array
Select or Download Code

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 wandering the Monastery: (6)
As of 2014-12-25 19:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (162 votes), past polls