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

Re: 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 17:36 UTC ( [id://11107142]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use 5.010;                                                            
    +          
    
    my $str1 = 'MALSSTAATTSSKLKLSNPPSLSHTFTASASASVSNSTSFR';
    
    my $a_count = $str1 =~ tr/A/A/; # 6
    
  2. or download this
    #!/usr/bin/env perl
    
    use 5.010;
    ...
            say "A: $a, length: " . length;
        }
    }
    
  3. or download this
    open my $fh, '<', $filename
        or die "Couldn't open $filename: $!";
    
    for (<$fh>) {
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (1)
As of 2024-04-24 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found