Hey all, Currently I am working on the Linux /etc/passwd file. Now I want to be able to split the /etc/passwd file for example...
tunnel:x:503:503::/home/tunnel:/bin/bash test:x:504:50:Test Account:/home/test:/bin/false test2:x:507:502:Test Account:/home/test2:/bin/false daniel:x:508:45:Thats Me:/home/daniel:/bin/false *test6:x:509:45:Test Account:/home/test6:/bin/false Now I have no trouble actually splitting the file but what I really want to do is have all the values of $lines $file = '/etc/passwd'; open PASSWD, "$file" or die "$file: $!\n"; while ($lines = <PASSWD>) { @lines = split (/:/, $lines); if ($lines[3] == 45 ) { #Store all users and their gids in a hash! $users{$lines[4]} = $lines[0]; } } close PASSWD; foreach $fullnames (keys %users) { print $fullnames, "\n"; } foreach $usernames (values %users) { print $usernames, "\n"; } Why is it the hash doesn't insert all the keys and values. I get a result that is complety wrong. Such as the following... %users = ( 'Test Account' => 'test6' ); This is about all I get. When we all know very well that the file ($file) contains alot more users with a GID of 45. Can some one point me into the right direction as to what I am doing wrong here? Thx, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]