in reply to Re^4: RegEx Question
in thread RegEx Question

It depends a great deal on what you consider to be 'easy' and probably also it depends what it is that you actually want to achieve. The following code may help:

use strict; use warnings; for my $number (1233456, 10, 1, 555789041) { my %digits; my @failDigits = grep {++$digits{$_} == 2} split '', $number; next if ! @failDigits; print "Number $number failed for:\n"; print " $_: $digits{$_} places\n" for @failDigits; }

Prints:

Number 1233456 failed for: 3: 2 places Number 555789041 failed for: 5: 3 places

True laziness is hard work