in reply to Variable still not holding contents
Slow things down a bit, give yourself some space, and use a loop to generate the candidate password -- put it in a subroutine, maybe, to keep it clear:
One closing tip: I've seen people get really bolixed because they are sent a password like "lXIg1v0WO" -- given the chance to control which letters are available to go into a random password, I would tend to leave "I1l" and "0O" out of the set, because they are too easily confused and misread.... my $pw; do { $pw = make_new_pw(); } while ( grep { $pw eq $_ } @stored ); ... # update: moved the declaration of @chars into the subroutine, # where it belongs: sub make_new_pw { my @chars = ( "A" .. "Z", "a" .. "z", 0 .. 9, qw( ! @ $ % ^ & *) ) +; my $newpw = ""; for ( 1 .. 17 ) { $newpw .= $chars[ rand @chars ]; } return $newpw; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Variable still not holding contents
by jdporter (Paladin) on Jan 07, 2003 at 14:26 UTC | |
by graff (Chancellor) on Jan 08, 2003 at 05:54 UTC |