Hello all! Can some one help me with the following hash of a hash?
I need to create a hash of a hash in the following format... %popusers = ( 'user1' => { 'Fullname1' => 'YES', } 'user2' => { 'Fullname2' => 'NO', } 'user3' => { 'Fullname3' => 'YES', } 'user4' => { 'Fullname4' => 'YES' } ); So far if I do the follwowing... #!/usr/bin/perl -w $file = '/etc/passwd'; sub view_users{ open PASSWD, "$file" or die "$file: $!\n"; flock(PASSWD, 2) || die "Can't lock $file exclusively: $!"; while ($lines = <PASSWD>) { @lines = split (/:/, $lines); if ($lines[0] != /^\*/) { #Do not print users witha an asterix (*) } elsif ( $lines[3] == 45 ) { $users{$lines[0]} = $lines[4]; } } #Delete any users with a * before their name delete @users{grep /^\*/, keys %users}; return %users; close PASSWD; } view_users(%users); Now this will print a hash like so %users ( 'user1' => 'Fullname1', 'user2' => 'Fullname2', 'user3' => 'Fullname3', 'user4' => 'Fullname4', }; But I also need it to add the following in... foreach $user_check (keys (%users)) { if (-e "/home/$user_check/$procrc") { $popusers_file{$user_check} = 'YES'; } else { $popusers_file{$user_check} = 'NO'; } } Which will do the following... %popusers_file ( 'user1' => 'YES', 'user2' => 'NO', 'user3' => 'NO', 'user4' => 'YES', }; So I need the values of %popusers_file to be the final values in %popusers. Is this possible? Regards, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]