Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: substrings that consist of repeating characters

by tybalt89 (Monsignor)
on Sep 27, 2020 at 20:23 UTC ( [id://11122271]=note: print w/replies, xml ) Need Help??


in reply to substrings that consist of repeating characters

TIMTOWTDI

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11122267 use warnings; my $string = "AAATTTAGTTCTTAAGGCTGACATCGGTTTACGTCAGCGTTACCCCCCAAGTTATT +GGGGACTTT"; my @substrings; push @{ $substrings[length $1] }, $1 while $string =~ /(([ACTG])\2+)/g +; my @sorted = map @{ $_ // [] }, reverse @substrings; use Data::Dump 'dd'; dd \@sorted;

Outputs:

[ "CCCCCC", "GGGG", "AAA", "TTT", "TTT", "TTT", "TT", "TT", "AA", "GG", "GG", "TT", "AA", "TT", "TT", ]

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-25 10:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found