in reply to I really need help with perl data structures and HTML::Template

Whenever I start using any data structures, I use Data::Dumper profusely. Data::Dumper will simply print out the entire data structure with the proper reference notation. It is a great way to start debugging scripts when you dont understand the data you are dealing with. Of course lhoward's advice is definately more valuable: use strict. Here is an example of Data::Dumper
use Data::Dumper; my %hash = ('a'=>1, 'b'=>2, 'b'=>3); my @array = ('c','d','e','f'); my $data = {%hash}; $data->{'array'} = [@array]; $data->{'array'}[4] = {%hash}; $data->{'array'}[4]{'foobar'} = [@array]; print Data::Dumper->Dump([$data], ['data']);
Results:
$data = { 'a' => 1, 'b' => 3, 'array' => [ 'c', 'd', 'e', 'f', { 'foobar' => [ 'c', 'd', 'e', 'f' ], 'a' => 1, 'b' => 3 } ] };
And you can use it to print out any unknown object, such as a CGI object:
use CGI qw(:standard -debug); my $cgi = new CGI; print Data::Dumper->Dump([$cgi], ['cgi']);
I entered in values of 'foobar=val, and 'submit=sumbit' and the Results:
$cgi = bless( { '.charset' => 'ISO-8859-1', 'foobar' => [ 'val' ], '.parameters' => [ 'foobar', 'submit' ], 'submit' => [ 'sumbit' ], '.fieldnames' => {} }, 'CGI' );
The notations for {} mean hash references and the notation for [] is for array references.