Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How can I get correct result in counting 3-letter words?

by ikegami (Patriarch)
on Apr 22, 2012 at 20:02 UTC ( [id://966491]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    while ($seq =~ /GCT/ig) { $GCT++; }
    
  2. or download this
    while ($seq =~ /\G(?:...)*?GCT/sig) { $GCT++; }
    
  3. or download this
    while ($seq =~ /\G(...)/sg) { $GCT++ if uc($1) eq 'GCT'; }
    
  4. or download this
    while ($seq =~ /\G(...)/sg) { $counts{uc($1)}++; }
    
  5. or download this
    my %counts;
    ++counts{uc($_)} for $seq =~ /.../sg;
    ...
          print("\n");
       }
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://966491]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2024-04-25 16:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found