Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: Determining uniqueness in a string.

by thundergnat (Deacon)
on Oct 01, 2005 at 02:01 UTC ( [id://496582]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Determining uniqueness in a string.
in thread Determining uniqueness in a string.

Actually, the print statement is probably much more expensive than any of those comparisons.

Anyway, I noodled with the script a bit.

#!/usr/bin/perl use warnings; use strict; while ( <> ) { chomp; (/^\d{10}$/) ? print uniq($_)+0,"\n" : die "Not 10 digits.\n"; } sub uniq { return $_[0] !~ /(.).*\1/ }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-20 03:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found