my @chars = ( "A" .. "Z", "a" .. "z". 0 .. 9 qw( ! @ $ % ^ & *) ); #### # attempt at looping unless ($_ ne @stored) { $pw = join(@chars[map{rand @chars} (1..17)]; } #### until ( $_ not in @stored ) #### while ( $_ in @stored ) #### $n_found = grep { $pw eq $_ } @stored; #### while ( grep { $pw eq $_ } @stored ) #### $pw = join(@chars[map{rand @chars} (1..17)]; while ( grep { $pw eq $_ } @stored ) { $pw = join(@chars[map{rand @chars} (1..17)]; } #### do { $pw = join(@chars[map{rand @chars} (1..17)]; } while ( grep { $pw eq $_ } @stored );