Here is my 2 bits worth:

Please show some simple input and output. I didn't completely understand your question.

The below code shows some common techniques. If you want sequences of digits (a list of solutions) that don't repeat, the code is different, but not by much.

#!/usr/bin/perl -w use strict; use Data::Dumper; my @test =(112,1234,1424); foreach (@test) { if (is_num_repeated($_) ) { print "$_ FAILED digit is repeated\n"; } else { print "$_ OK no digit repeated\n"; } } foreach (@test) { print "no_repeat: $_ string before repeat is: ", first_non_repeating_digits($_),"\n"; } sub is_num_repeated { my $num = shift; my @digits = split(//,$num); my %seen; foreach (@digits) { $seen{$_}++; } # this is grep in a scalar context... return (grep {$_ >1} values %seen); } sub first_non_repeating_digits { my $num = shift; my @digits = split(//,$num); my %seen; my $result; foreach (@digits) { return $result if ($seen{$_}++); $result .= $_; } return $result; } __END__ 112 FAILED digit is repeated 1234 OK no digit repeated 1424 FAILED digit is repeated no_repeat: 112 string before repeat is: 1 no_repeat: 1234 string before repeat is: 1234 no_repeat: 1424 string before repeat is: 142

In reply to Re: RegEx Question by Marshall
in thread RegEx Question by yoda54

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.