Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Determining uniqueness in a string.

by davido (Cardinal)
on Oct 01, 2005 at 00:49 UTC ( [id://496568]=note: print w/replies, xml ) Need Help??


in reply to Determining uniqueness in a string.

Hashes are good at determining uniqueness. Here's an example:

sub uniq { my %hash; @hash{ split //, $_[0] } = (); return length $_[0] == keys %hash }

Dave

Log In?
Username:
Password:

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

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

    No recent polls found