Hi Dan,

Try this:

# --
%flags=();
foreach $user ( keys (%popusers) ) {
        if (-e "/home/$user/test.pl") {
                $flags{$user} = "YES";
        } else {
                $flags{$user} = "NO";
        }
}
# --

I hope that helps,

Ahmed

Daniel Falkenberg wrote:

> Hi All,
> 
> Just working on a new hash that I need some help with...
> 
> Firstly....
> 
> I can create a hash like the following no problem....
> 
> %popusers = (
>                 'user1' => 'Fullname1',
>                 'user2' => 'Fullname2',
>                 'user3' => 'Fullname3',
>             );
> 
> Foreach user i.e. (user1, user2 and user3) a home directory exists such
> as /home/user1/
> 
> Now I need my script to check each home dir. for a file of test.pl if
> the file exists then I need it to create the following hash.... with a
> YES for yes the file exists and NO if the file doesn't....
> 
> %popusers_file = (
>                 'user1' => 'YES',
>                 'user2' => 'YES',
>                 'user3' => 'NO',
>             );
> 
> Would I start by doing something like the following...
> 
> foreach $user (keys %popusers) {
>   #Check each home dir /home/$user for file test.pl
>   #Begin new hash (%popusers_file)
> }
> 
> Is this the correct way of going about this one???
> 
> Regards,
> 
> Dan

-- 
Ahmed Moustafa
[EMAIL PROTECTED] | http://arbornet.org/~ahmed


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to