in reply to While loops with if
#!/usr/bin/perl use CGI::Carp 'fatalsToBrowser'; use strict; use warnings; use CGI; my $query = CGI->new; print $query->header; my $usedpw = "logfile.txt" ; my @chars = ( "A" .. "Z", "a" .. "z", 0 .. 9, qw(! @ $ % ^ & *) ); my $pw = join @chars[map{rand @chars} (1..17)]; # opening for reading open(USEDPW, "< $usedpw") or die $!; flock USEDPW, 1; close(USEdPW); while (1) { my @chars = ( "A" .. "Z", "a" .. "z", 0 .. 9, qw(! @ $ % ^ & *) ); if ($usedpw ne m/$pw/) { print "Your unique password is: $pw\n"; } } open(USEDPW, "> $usedpw") or die $!; flock USEDPW, 2; print USEDPW "$pw\n"; close(USEDPW);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: While loops with if
by jdporter (Paladin) on Jan 03, 2003 at 19:22 UTC | |
|
Re: Re: While loops with if
by chromatic (Archbishop) on Jan 03, 2003 at 19:15 UTC |