Thanks!  That should help alot.  Since I also want the mac address I can do something like...
 
@keys = keys %{$arpCache{$mac_address}};
foreach $key @keys {
    push @outer_loop, { mac_address => $_ };
}
in the template
<TMPL_LOOP outer_loop>
     <TMPL_VAR mac_address>
      <TMPL_LOOP arp_cache_mac_address>
            <TMPL_VAR ip_address>
     </TMPL_LOOP arp_cache_mac_address>
</TMPL_LOOP outer_loop>
 
Thanks again!
 

Mitchell Raful MCSE CCNP
MCB Quantico
Personal and Family Readiness (MRI)
3044 Catlin Avenue
Quantico, VA 22134
Com: 703-784-5991
DSN: 278-5991
Cell: 804-363-0731

-----Original Message-----
From: Mathew Robertson [mailto:mathew.robertson@netratings.com.au]
Sent: Tuesday, January 08, 2008 6:02 PM
To: Raful Mr Mitchell H
Cc: html-template-users@lists.sourceforge.net
Subject: Re: [htmltmpl] hash of hashes

Without further information on what you are trying to do and why you are making the hash like so - I'm not sure what you are asking. ie: what are you trying to loop through, a list of IP addresses? the arp cache?

assuming the IP address:

  my $ht = HTML::Template->new("some.tmpl");
  my @loop;
  foreach (@{$arpCache{$mac_address}}) {
    push @loop, { ip_address => $_ };
  }
  $ht->param(arp_cache_mac_address => \@loop);

in the "some.tmpl":

  <TMPL_LOOP arp_cache_mac_address>
    ...
    <TMPL_VAR ip_address>
    ...
  </TMPL_LOOP>


Alternatively if you are willing to change the push(...), you could write it as:

  push( @{$arpCache{$mac_address}}, { ip_address => $ip_addr } );
  ...
  $ht->param(arp_cache_mac_address => $arpCache{$mac_address} );


Hope this helps,
Mathew

Raful Mr Mitchell H wrote:
My code puts together a hash like so...
 
push( @{$arpCache{$mac_address}}, $ip_addr );
 
How on earth could I get that output via a  TMPL_LOOP with TMPL_VAR?  Or is there a different way?
 
Thanks,
 
Mitch

Mitchell Raful MCSE CCNP
MCB Quantico
Personal and Family Readiness (MRI)
3044 Catlin Avenue
Quantico, VA 22134
Com: 703-784-5991
DSN: 278-5991
Cell: 804-363-0731

 

------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________ Html-template-users mailing list Html-template-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/html-template-users