my $a = '12345678901'; my $cnt = $a =~ tr/1//; #In this case $cnt = 2, which means it is not unique