sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; use CGI; use CGI::Carp 'fatalsToBrowser'; my $q = CGI->new; print $q->header; my $saved = "savedpasswords.txt"; my @chars = ( "A" .. "Z", "a" .. "z". 0 .. 9 qw( ! @ $ % ^ & *) ); open(SAVEDPW, "< $saved") or die $!; flock(SAVEDPW, 1) or die $!; my @stored = <SAVEDPW>; close(SAVEDPW); chomp(@stored); my $pw; # attempt at looping unless ($_ ne @stored) { $pw = join(@chars[map{rand @chars} (1..17)]; } # loop is over, we have a new password print "Your new password is: $_"; open(SAVEDPW, ">> $saved") or die $!; flock(SAVEDPW, 2) or die $!; print SAVEDPW "$_\n"; close(SAVEDPW);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Variable still not holding contents
by jdporter (Paladin) on Jan 07, 2003 at 06:05 UTC | |
|
Re: Variable still not holding contents
by virtualsue (Vicar) on Jan 07, 2003 at 11:00 UTC | |
|
Re: Variable still not holding contents
by djantzen (Priest) on Jan 07, 2003 at 06:19 UTC | |
|
Re: Variable still not holding contents
by graff (Chancellor) on Jan 07, 2003 at 06:57 UTC | |
by jdporter (Paladin) on Jan 07, 2003 at 14:26 UTC | |
by graff (Chancellor) on Jan 08, 2003 at 05:54 UTC | |
|
Re: Variable still not holding contents
by Zaxo (Archbishop) on Jan 07, 2003 at 16:19 UTC | |
|
Re: Variable still not holding contents
by PodMaster (Abbot) on Jan 07, 2003 at 07:18 UTC |