Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: find reverse complement of every 2nd line

by syphilis (Chancellor)
on Jul 09, 2013 at 23:40 UTC ( #1043396=note: print w/replies, xml ) Need Help??


in reply to Re^2: find reverse complement of every 2nd line
in thread find reverse complement of every 2nd line

my problem actually is doing this only to every other line and not the entire file

The special variable $. (documented in perldoc perlvar) keeps count of the line numbers, so you can do something like:
while(<IN>) { next if $. % 2; # skip odd lines # do the processing }
Cheers,
Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043396]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2017-08-22 19:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Who is your favorite scientist and why?



























    Results (339 votes). Check out past polls.

    Notices?