On Tue, 2005-01-25 at 18:55, Ankur Gupta wrote:
> 
> Mariano Cunietti wrote:
> > > #foreach $destination (@dest_users) {  # NO NEED FOR THIS
> > >            #print "==>$destination\n";                            
> > > 
> > > push( @{$aliases{$alias}}, @dest_users );
> > > 
> > > foreach $key ( keys %aliases ){
> > >     print "$key: @{$aliases{$key}}\n";
> > > }
> > >     
> > Thanks a lot, it helps by showing the correct syntax. 
> > But it's not exactly what I meant. Your suggestion shows how to print
> > out the same file that I read, and it is /etc/aliases, in the form
> > 
> > alias: user1 user2  etc.
> > 
> > What i need is
> > 
> > user1: alias1 alias2 alias3
> > 
> > Thanks anyway
> > 
> >   
> Not a problem.. just reverse it... look at the push statement below. 
> Let me know if I am still missing anything..
> 
> my (@dest_users);
> while(<ALIASES>)
> {
>         next if(/^[\s]*$/);
>         next if(/^[\s]*#/);
>         next if(/:include:/);
>         chomp;
>         my ($alias,$realusers)=split(/:/,$_);
>         #print $aliases."\n";
>         $realusers =~ s/[\s]//g;
>         @dest_users=split(/,/,$realusers);
>         my ($destination);
>         #print "ALIAS: $alias\n";
>         foreach $destination (@dest_users) {
>            push ( @{$inversealias{$destination}}, $alias);
>       }
> }

foreach $destination (@dest_users) {
                push( @{$aliases{$destination}},$alias);
        }
}
my $key;
foreach $key ( keys %aliases ){
    print "$key: @{$aliases{$key}}\n\n";
}

thank you all ;-)

-- 
-----------------------------
Mariano Cunietti
System Administrator
Enter S.r.l.
Via  Stefanardo da Vimercate, 28
20128 - Milano - Italy
Tel.  +39 02 25514319
Fax   +39 02 25514303
[EMAIL PROTECTED]
www.enter.it - www.enterpoint.it
-----------------------------
Gruppo Y2K - www.gruppoy2k.it


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to