Hello

Your subroutine call is fine :

&SetACLs(\@READDIR,$readDir);

What you are doing is passing a variable pointing to an array... effectively a
pointer. Therefore you need to reference the contents of your pointer. Like
this

sub yoursub {

# Localise it (good idea)    my($rdref) = @_;           # Loop through the array 
located at reference passed

   foreach $item(@{$rdref}) {         # Do your stuff

   }

}

Hope that helps

Matthew







>>> "[EMAIL PROTECTED]" 02/15/02 01:54pm >>>
Hi all....
I need some help using references.  Inm using Perl v5.6.1 built 626
provided by ActiveState.

Here is where inm stuck:

---Code (simplified) ---

use Win32::FileSecurity qw(Get Set);

sub SetACLs
{
    foreach (@_) <------ How should I do to pass to the foreach my referenced
array at the sub call???????
    {
        if ((!(-e $_)) || (!(Win32::FileSecurity::Get($_, \%hash ))))
{print "Error accessing ACLs for $_\n"}
        else
        {
            $hash{'Everyone'} = $_[1];
            if (!Win32::FileSecurity::Set( $_, \%hash )) {print "Error
setting ACLs at $_\n"}
        }
    }
}

##main##
$readDir = 2685534377;
@READDIR= qw(
    C:\WINNT
    C:\WINNT\SYSTEM
    C:\WINNT\SYSTEM32
    C:\WINNT\SYSTEM32\DRIVERS
    C:\WINNT\SYSTEM32\SPOOL
    );

&SetACLs(\@READDIR,$readDir); <--- Here is where i pass the referenced array
to my subroutine


If anyone could help me, thanks in advance

Ariel

                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                                                                       
                                   _______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to