Perl now:<document> <position> <departments> <department name = "Nothing Selected" /> <department name = "Pricing and Shopping Systems" /> <department name = "Commercial" /> <department name = "Operations Hardware" /> <department name = "Corporate Marketing" /> <department name = "Legal" /> <department name = "Human Resources" /> <department name = "Finance" /> </departments> </position> </document>
With strict on I get error: Global symbol "@department" requires explicit package name.#!/perl use strict; use warnings; use lib 'C:/xampp/perl/site/lib'; use HTML::Template; $ENV{XML_SIMPLE_PREFERRED_PARSER} = 'XML::Parser'; use XML::Simple; use Data::Dumper; my $template = HTML::Template->new(filename => 'file'); my $xml = XMLin('file', ForceArray => ['departments']); my @department = @{ $xml->{position}->{departments} }; $template->param(DEPT => \@deptartment); print $template->output;
With strict off I get no errors, but nothing shows up on my template.
Using Dumper, my xml data looks right but displays something like
I'm thinking maybe the empty curly braces have something to do with why it's not actually displaying anything?$VAR1=[ {department => { 'Finance' => {}, 'Human Resources' => {} } ]
In reply to Re^2: Problems getting info from .xml to display with HTML::Template
by Anonymous Monk
in thread Problems getting info from .xml to display with HTML::Template
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |