You could also do something like:
sub mylineOK { my ($line) = @_; my @ebase = ("A","T"); my $limit = 15; for ( @ebase ) { my $cnt = ( $line =~ s/$_//g ); return 0 if ( $cnt >= $limit ); } return 1; }
Which will just count the number of times the ebase is stripped from the line.

Update:

All of these return the correct answer (in my very limited dataset). Here are some benchmarks.
Rate Original Moritz Tr m Strip +ExplicitTr Original 87.3/s -- -95% -97% -99% -99% + -100% Moritz 1613/s 1748% -- -50% -74% -81% + -98% Tr 3226/s 3596% 100% -- -48% -62% + -96% m 6250/s 7060% 288% 94% -- -27% + -92% Strip 8571/s 9720% 431% 166% 37% -- + -89% ExplicitTr 75000/s 85825% 4550% 2225% 1100% 775% + --
Note that explicit tr uses a hardcoded "A" and "T" in place of a variable. (i.e. tr/A/A/ and tr/T/T/) The eval is what kills the performance.

In reply to Re: searching characters by Transient
in thread searching characters by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.