sub check_duplicates { my $candidate = shift; ++$flag if $candidate =~ /(.).*\1/; }