in reply to Perl and XML

To elaborate on what bart said, you have to print out a Content Header if you want to view this as a web page from a browser. One easy way is to use CGI.pm:
use strict; use XML::Simple; use CGI qw(header); print header('text/plain'); my $xs1 = XML::Simple->new(); my $doc = $xs1->XMLin('files/camelids.xml'); foreach my $key (keys (%{$doc->{species}})){ print $doc->{species}->{$key}->{'common-name'} . " ($key) "; print $doc->{species}->{$key}->{conservation}->{status} . "\n"; }
You also have to make sure that the CGI file is executable by everyone ... "chmod 755 foo.cgi" should do the trick if you have command line access.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re: Re: Perl and XML
by BzBeauty (Sexton) on Mar 16, 2004 at 23:19 UTC
    thank you - got it, that was the problem