print $clear_screen; print "CREATE ACCOUNT:\n\n"; $username = &ask("Enter the login id of the new user: "); my %account; my %uid; # # Read the local passwd file. # open (PWD,"$LOCAL_PASSWD") or die "\n\nUnable to open $LOCAL_PASSWD\n\n"; while () { chomp; my ($accountname, $accountid) = (split/:/)[0,2]; $account{$accountname} = $accountid; $uid{$accountid} = $accountname; } close (PWD); if (exists $account{$username}) { die "This account name already exists!\n"; } # # Loop through our range and see if we have an available number. # If a hash entry does not exist, use the missing number. foreach (200..2000) { unless ( exists $uid{$_} ) { print "Hey $_ is available!...assigning...\n"; $g_user_id = $_; last; } }