Edward G. Orton, GWN Consultants Inc.
Phone: 613-764-3186, Fax: 613-764-1721
email: [EMAIL PROTECTED]
----- Original Message -----
From: "MacAlpine, Tim" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, April 02, 2002 4:01 PM
Subject: Help with an "Array of Hashes"
> I'm trying to work with Win32::Perms and in order to get the
list of ACEs
> you use a Get method and pass it an array reference. This
should load hash
> references into the array whose reference you passed. Now I
can't seem to
> get at the hashes. I've included a code snippet below. When I
run this as
> written I get nothing out of the foreach section - it just
moves on to my
> "All done!" and exits. I'm thinking I need to understand
> reference/dereference syntax, but I just can't tell at this
point. Any
> ideas?
>
> $FileSD = new Win32::Perms(dacl1.txt); # new Perms object
which is
> the Security Descriptor info for the file dacl1.txt
>
> $SDcnt = $FileSD->Get( \@ACElist ); # returns the number of
ACEs and
> loads their info into hashes referenced in the array
>
> foreach $ACE ( @ACElist ) { # for each Access Control
Entry...
>
> print "ACE = $ACE \n"; # (just want to see what we're
getting)
>
> foreach $ACEitem (keys %$ACE) { # ... get the name/value
pairs...
>
> print "Item - \'$ACEitem\' = \'$ACE{$ACEitem}\'\n<br>"; #
...
> and print them.
>
> }
>
> }
You missed one little item:
print "Item - \'$ACEitem\' = \'$$ACE{$ACEitem}\'\n<br>"; # ...
You need two "$" signs in from of ACE. One for the array
element, and one for the hash element.
This should work for you.
ego
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs