Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Getting the count of a particular alphabet using subroutine

by suhailck (Friar)
on Aug 06, 2010 at 06:08 UTC ( [id://853323]=note: print w/replies, xml ) Need Help??


in reply to Getting the count of a particular alphabet using subroutine

To count the occurence of an alphabet, you can use tr as in the below code,

perl -le '$string=q[ttc actssat tb];$count=$string=~tr/t//;print $coun +t' 5


~suhail

Replies are listed 'Best First'.
Re^2: Getting the count of a particular alphabet using subroutine
by changma_ha (Sexton) on Aug 06, 2010 at 06:28 UTC

    Thanx suhailck... now my problem is solved.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-10-10 17:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (45 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.