Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: What is wrong in this code???

by BillKSmith (Curate)
on Dec 08, 2012 at 20:02 UTC ( #1007921=note: print w/ replies, xml ) Need Help??

in reply to What is wrong in this code???

A much shorter solution (probably slower) uses a regexp to copy all the A's to a temp array and then uses the size of that array as the count. Repeat for other letters.

use strict; use warnings; use Data::Dumper qw(Dumper); my @letters = ('A', 'T', 'G', 'C', '-'); while (my $seq = <>){ print $seq; my @temp; my %cnts = map {($_, scalar ( @temp = $seq =~ /($_)/g))} @letters; print Dumper \%cnts; }

Comment on Re: What is wrong in this code???
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2015-11-25 21:51 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (691 votes), past polls