Hi,
 
I have a flat  file data in the form of user and groups. The user always come first 
follow by the groups. Now I need to arrange then by  groups. This is the code I have 
been working with. the groups are listing but the users are not.  I am still fairly 
new  to perl so I need someone with simple code? Can someone offer any assistance ?
 

my %group_to_users = ();
while (my $line = <USERFH>) {
    chomp ($line);
    my ($user, @user_groups) = split ('\s+', $line);
    for my $group (@user_groups) {
      push @group_to_users, $user ;
   $group_to_users{$group} = [$user] ;
    }
}
close (USERFH);
for my $group (sort keys %group_to_users) {
    print $group . ":\n";
        print $group_to_users{$group} . "\n";
    }


 
   
 
 


                
---------------------------------
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.

Reply via email to