singsing has asked for the wisdom of the Perl Monks concerning the following question:
sub adduser{ $passwd = shift; my ($out,$pw); my @salt = ("A".."Z","a".."z","0".."9","/",",","."); USER:{ print CLIENT "New UserName:"; my $username=<CLIENT>; if ($username =~ /\S+/){ chomp $username;} else{goto USER; } $out = "$username" ; } PASS:{ print CLIENT "New User Password:"; my $password=<CLIENT>; if ($password =~ /\S+/){ chomp $password;} else{goto USER; } my $salt = $salt[rand @salt].$salt[rand @salt]; my $pw = crypt($password,$salt); $out = "$out:$pw\n"; } open PASSWD, ">> $passwd" || die" problem appending to $passwd :$! \n"; print PASSWD "$out"; close PASSWD; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 1: print() wierdness
by tilly (Archbishop) on Apr 04, 2001 at 21:20 UTC | |
|
Re: print() wierdness
by dws (Chancellor) on Apr 04, 2001 at 21:19 UTC | |
|
Re: print() wierdness
by isotope (Deacon) on Apr 04, 2001 at 21:23 UTC |