Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (12)
As of 2016-09-27 19:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (511 votes). Check out past polls.