Hi list, I have a unique problem here where I have a daemon perl script running. The code below sits in a while loop in my Perl daemon. If the $status ever equals a 6 then the chunk of code below is executed. Now the problem is is that the code never updates. Ie if I happed to add a * in front username with a GID of 45 in /etc/passwd then then code below won't read from it and remove it from my hash? If I restart the daemon the code has no problems reading from it and everythink works fine. Of coarse I don't want to do this everytime I change the /etc/passwd file.:) So it seems to me that the hash I am using isn't being u ndefined (Think this is the correct terminology). Can any one give any ideas? Does this even make sense to any one? Would the following work...?
undef %users; Kind Regards, Dan ___PERL CODE START____ open PASSWD, "$passwd" or warn "$passwd: $!\n"; flock(PASSWD, 2) || warn "Can't lock $passwd exclusively: $!"; while (<PASSWD>) { my ($username, $groupid, $fullname) = (split/:/)[0, 3, 4]; next if $username =~ /^\*/; next if $username =~ /^ruby/; if ( $groupid == 45 ) { $users{$username}{$fullname} = 0; if (-e "/home/$username/$homeproc") {$users{$username}{$fullname} = 'YES';} else {$users{$username}{$fullname} = 'NO';} } } close PASSWD || warn "$passwd: $!\n"; open FILE, ">$userfile" or warn "cannot open $userfile: $!\n"; flock(FILE, 2) || warn "Can't lock $userfile exclusively: $!"; print FILE "[USERS]\n"; foreach my $user (keys %users) { foreach my $name (keys %{ $users{$user} } ) { print FILE "$user:$name:$users{$user}{$name}\n"; } } print Data::Dumper -> Dump( [\%users], ['*users']); close(FILE) or warn "Closing: $!"; ___PERL CODE END____ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]