For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > January 2005 > SOLVED: hashes of arrays?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SOLVED: hashes of arrays?
Mariano Cunietti

2005-01-25, 3:56 pm

On Tue, 2005-01-25 at 18:55, Ankur Gupta wrote:
>
> Mariano Cunietti wrote:
> 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
mcunietti@enter.it
www.enter.it - www.enterpoint.it
-----------------------------
Gruppo Y2K - www.gruppoy2k.it

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com