Hi,
I'm trying to write a script to "invert" an alias database file. I mean,
I want to generate a list  where the key is the name of the user, and
the value is the list of the aliases this user is involved into.
Something like /etc/group file, as an example.

I was wondering how could I use hashes and arrays to store these
information. The next step is to parse each item (key=username), open
each user's mailbox and look for @alias in any '^To:' line

At this point, the script is:

=============================
#!/usr/bin/perl
use strict;
use warnings;

open (ALIASES,'/etc/aliases') or die ("Cannot open /etc/aliases for
input: $!");

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) {
           #print "==>$destination\n";
           # HELP NEEDED HERE!
        }
}

=============================

I'm not used to manage perl hashes as I did in multidimensional arrays
in PHP. Is it possible to store an array in a hash item? And how shold I
do that? Which is the way to recall the value?
TIA

Mariano

-- 
-----------------------------
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