Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: What is wrong in this code???

by BillKSmith (Vicar)
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; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007921]
[Corion]: Hi all! After 13 years or so in the same room, I've now moved to a new room (one door further) - weird :-D
[moritz]: I had an office move too, two floors up
[moritz]: so far I've managed not to get into my old office by accident, but once it was close (already stopped at the wrong floor)

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2017-10-17 08:57 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (224 votes). Check out past polls.