Hi, I must apologise for taking the time to rewrite your script, even though the issues could probably be easily fixed. It just seemed an easier way to express several changes *I would have made*, but you might not have.
In doing so, I learned a few issues/bugs with your own version. In particular: 1. You already try to avoid disabled accounts, so you should be concentrating on fixing that... rather than trying to filter them out again. I think you've got the if and match logic a little messed up. 2. The close appeared after the return from the function, leaving the file unintentionally open. You should also test the return value of close, since it can fail. perldoc -f close And some style related issues, which you are free to ignore: 1. "use strict" can be useful for larger scripts, which forces you to increase your coding discipline. Certain things like not declaring variable you use create warnings/errors. Worth using for longer scripts, IMHO. 2. Code reads easier if you split into named variables. 3. When looping you don't _have to_ do something like: while ($line = <>) { ... } I think it reads easier without that $line variable - without which $_ is set instead. Most operators implicitly work with $_ anyway, thus you can make the code easier to read... again in IMHO. The data structure you use doesn't seem that flexiable, how do you find out the status of the .procmailrc file using just the username? I think you've nested it one too deep. It's easy to change if you want. Finally, you are quite correct to seperate the testing of ..procmailrc from reading of the passwd file. You want to lock the file for as little time as possible... but don't you have to unlock it? Anyway, don't let me stop you having fun! Take care, Jonathan Paton PS: Untested script! PSS: Avoid placing anything in the subject line that suggests you've got no further issues to solve - unless you mean it. Most people will have glanced over your last message. --- PERL SCRIPT --- use strict; use Data::Dumper; my $passwd = '/etc/passwd'; my $procrc = '.procmailrc'; sub view_users{ open( PASSWD, $file) or die "$file: $!\n"; flock(PASSWD, 2) or die "Can't lock $file exclusively: $!"; my (@users, %popusers); # Process the password file while (<PASSWD>) { my ($username, $groupid, $fullname) = (split /:/)[0, 3, 4]; # Skip disabled accounts next if $username =~ /^\*/; # Only keep those users in group 45 if ( $groupid == 45 ) { push @users, $username, $fullname; } } # Test each account for the existance of the ..procmailrc file for (1 .. (scalar @users) / 2) { my ($username, $fullname) = @users[$_-1, $_]; # Perform the check my $exists = (-e "/home/$username/$procrc") ? ('YES') : ('NO'); # Place the information into the hash we return $popusers{$username}{$fullname} = $exists; } close PASSWD or die "$file: $!\n"; return %popusers; } view_users(); print Data::Dumper -> Dump( [\%popusers], ['*popusers']) __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]