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

Re^3: How to count the length of a sequence of alphabets and number of occurence of a particular alphabet in the sequence?

by rjt (Curate)
on Oct 07, 2019 at 18:30 UTC ( [id://11107149]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $len = length;
    $bins{$len} //= [ ];      # Set to blank array ref if not already set.
    push @{$bins{$len}}, $a;  # Add $a to the array
    
  2. or download this
    for my $len (sort { $a <=> $b } keys %bins) {
        say "Length $len:";
        say for @{$bins{$_}};
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-03-28 08:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found