# Print open reading frames. # /[A-Z]+\*/ does not require a start codon, but does require a stop. # /M[A-Z]*\*/ requires both a start and stop codon. # /(^|M)[A-Z?]*(\*|$)/ requires start or beginning of line and stop or end of line. # Prints an empty line if there are no ORFs in the line in. # BUG: prints an extra space at the end of each line that has an ORF. while (<>) { while ( /(^|M)[A-Z?]*(\*|$)/go ) { print "$& "; } print "\n"; # Why doesn't the following work? The list includes the submatches in all parentheses. # @orfs, /(^|M)[A-Z?]*(\*|$)/g; # This works pretty well, except can't get beginning of line. # @orfs = /M[A-Z?]*\*?/g; # print "@orfs\n"; # This below is the same as above: # print join( ' ', /M[A-Z?]*\*?/g ), "\n"; }