in reply to Re: Determining hash order for sorting array
in thread Determining hash order for sorting array
The next CHILD if statement will be replaced with a subroutine to check for differences if I can get this right. My thought, regarding the hash order, was to see if there may be a better way to scan that hash for an existing user entry in the DB. And just by the way - I know that you Monks are huge advocates of using .pm's. There may indeed be one out there that I could adapt for this, however, being as new as I am to both Perl, and programming in general, it's in my best interest to reinvent the wheel :) Thanks again for the help Monks.CHILD:while( (my $key, my $value) = each %passwd){ for(@existing_users){next CHILD if /$key/;} $value =~ /\w*:(.*):(\d*):(\d*):(.*):(.*):(.*)/; my $query = "INSERT INTO passwd (username, pwd_loc, uid, gid, +gecos, home_dir, shell, hostname) values('$key', '$1', '$2', '$3', '$ +4', '$5', '$6', '$hostname')"; my $sth = $dbh->prepare($query); $sth->execute() || die("Couldn't exec sth!"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Determining hash order for sorting array
by punch_card_don (Curate) on Aug 21, 2005 at 16:24 UTC | |
by PenguinPwrdBox (Initiate) on Aug 21, 2005 at 16:50 UTC |