Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: number of unique characters in a string

by BrowserUk (Patriarch)
on Mar 01, 2003 at 04:49 UTC ( [id://239650]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #! perl -slw
    use strict;
    ...
    
    print nUniqC '1010101010';
    print nUniqC '1234567812';
    
  2. or download this
    sub nUniqC{
        my @uniq;
        scalar grep{ ++$uniq[$_] == 1 } unpack('C*',$_[0]);
    }
    
  3. or download this
    sub nUniqC{
        scalar grep{ ++$_[$_] == 1 } unpack('C*',$_[0]);
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-26 06:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found