Check out Data::Dumper, you'll love it!  www.perldoc.com
Pass it a ref and it prints out a pretty data structure recursively, so you
don't have to!  Ain't Perl Grand?


"Barry Kingsbury" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have created the following data structure:
>
> %mailings = ( tv => { mail_demo_key   => "Demo License Key for TotalView",
>                       mail_thank_you  => "Thank you for downloading
> TotalView",
>                       pdf             => LOCATION_OF_PDF,
>                       location        => LOCATION_OF_DEMO_REPLY,
>                       text            => LOCATION_OF_INSTRUCT,
>                       text_brochure   => LOCATION_OF_BROCHURE },
>               cr => { mail_demo_key  => "Demo License Key for JNI Bridge
> and TotalView",
>                       mail_thank_you => "Thank you for downloading the
> CodeRoad JNI Bridge",
>                       pdf            => LOCATION_OF_CR_PDF,
>                       location       => LOCATION_OF_CR_DEMO_REPLY,
>                       text           => LOCATION_OF_CR_INSTRUCT,
>                       text_brochure  => LOCATION_OF_CR_BROCHURE }
>             );
>
> In other words, the elements of the mailings hash are a key and a
> reference to an unnamed hash. After a lot of playing around, I was able
> to print the elements of the hash as follows:
>
>
>   $form_name = "tv";
>   foreach $key (keys %{$mailings{$form_name}})
>   {
>       print "$key => " . %{$mailings{$form_name}}->{$key} . "\n";
>   }
>
>
> Also, the following also works:
>
>   $form_name = "tv";
>   foreach $key (keys %{$mailings{$form_name}})
>   {
>       print "$key => " . ${$mailings{$form_name}}{$key} . "\n";
>   }
>
> I have no idea what this syntax is saying or doing and why the two
> different forms of the hash reference are working.
>
> Can some guru explain?
>
> Thank you
>
> Barry Kingsbury
> Etnus, LLC.
>
>
>
>
>
>
>



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

Reply via email to