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/ }
In reply to Re^4: Determining uniqueness in a string.
by thundergnat
in thread Determining uniqueness in a string.
by Yzzyx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |