in reply to Losing or overwritting values
#!/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 $usedpw) { 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'. | |
|---|---|
|
(jeffa) 2Re: Losing or overwritting values
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 | |
by Aristotle (Chancellor) on Jan 06, 2003 at 00:20 UTC | |
|