[EMAIL PROTECTED] wrote:
> Hi,
>
> I have a Problem understanding the sample code from Win32::Lanman
> (which works fine so far):
>
> ---------------------
> Win32::Lanman::NetFileEnum("\\\\servername", "$selecteddir", "", [EMAIL
> PROTECTED]);
> foreach my $info (@infos) {
> my @keys = keys(%$info);
> foreach my $key (@keys) {
> if ($key eq "pathname") {
> print "$key: ${$info}{$key}<br>";
> }
> }
> }
>
> ----------------------
>
> The variables are so much nested, that I just don't understand where
> all the relevant information is that I need... could anyone perhaps
> make that understandable for "dummies" ?;)
That first foreach hides a bit of the structure. It might be useful
to see the entire thing. I'll do it step by step.
BTW, the $info variable in the code above has nothing to do with my
examples below. The only "info" variable I am referring to is the
original array.
@info an array of hash references
$info[0] the first hash reference from the array
%{$info[0]} the hash itself (dereferenced)
${$info[0]}{$key} one hash element
You can simplify the last statement like this:
$info[0]->{$key}
or even this:
$info[0]{$key}
So, in answer to your question, what you have is a fairly simple array
of hashes.
--
Bowie
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs