Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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?
[Corion]: Heh - a good talk on Youtube about why you want to keep your Genome as secret as possible (and not use it for vanity stuff like 23andme , or some ancestry stuff)

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2018-01-19 18:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (222 votes). Check out past polls.

    Notices?