sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use CGI::Carp 'fatalsToBrowser'; use strict; use warnings; use CGI; my $query = CGI->new; my $usedpw = "logfile.txt"; my @chars; print $query->header; # opening for reading open(USEDPW, "< $usedpw") or die "poo poo on reading $!"; flock USEDPW, 1; # Storing the file handle, not a scalar, into an array for full readin +g my @used_pw = <USEDPW>; close(USEDPW); # remove trailing whitespace chomp my $used_pw; while (<USEDPW>) { my $pw = @chars[map{rand @chars} (1..17)]; } unless ($_ ne my $pw) { print "Your unique ID is: $pw\n"; } my $pw; open(USEDPW, "> $usedpw") or die "crap on me for writing $!"; flock USEDPW, 2; print USEDPW "$pw\n"; close(USEDPW);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Losing or overwritting values
by merlyn (Sage) on Jan 04, 2003 at 19:26 UTC | |
|
Re: Losing or overwritting values
by pfaut (Priest) on Jan 04, 2003 at 19:21 UTC | |
|
Re: Losing or overwritting values
by RhetTbull (Curate) on Jan 05, 2003 at 01:22 UTC | |
|
Re: Losing or overwritting values
by sulfericacid (Deacon) on Jan 04, 2003 at 19:05 UTC | |
by jeffa (Bishop) on Jan 04, 2003 at 19:37 UTC | |
by sauoq (Abbot) on Jan 05, 2003 at 02:48 UTC | |
by jeffa (Bishop) on Jan 05, 2003 at 16:41 UTC | |
by sauoq (Abbot) on Jan 06, 2003 at 00:04 UTC | |
|