Just another Perl shrine | |
PerlMonks |
Check even numbers?by Anonymous Monk |
on Aug 06, 2006 at 22:07 UTC ( [id://565869]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello there monks! I have a counter inside a Perl script, which counts the number of occurences of a certain pattern in a file. The lines in the file are something like: >protein1 sequence1 >protein2 sequence2 >protein3 sequence3 etc So, if, in each sequence, the program finds, for instance, the letter 'A', it adds 1 to the counter. What I want to print out is those proteins and their sequences, that have even number of occurences of the letter 'A' (2,4,6,8 etc). Is there a function or something that checks if a number is odd or even? Thank you!
Back to
Seekers of Perl Wisdom
|
|