awohld has asked for the wisdom of the Perl Monks concerning the following question:
And I get an error: "Software error: Not a CODE reference at mycode.pl line 15 (my %tmp = $parse->($address);)." when I try to assign the parse to a hash. I can print the parse straight out and it works.<LOC><HNO></HNO><STN>Eagle Way</STN><MCN>Gotham City</MCN></LOC>
What I'm trying to do is to create a hash from the XML code.#!/usr/local/bin/perl -w use strict; use CGI::Carp qw(fatalsToBrowser); use XML::Parser; use CGI; my $q = CGI->new(); print $q->header(); my $parse = new XML::Parser(Style => 'Objects'); my $address = "<LOC><HNO></HNO><STN>Eagle Way</STN><MCN>Gotham City</M +CN></LOC>"; my %tmp = $parse->($address); print "$parse->($address)";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Parser - Code Reference Error?
by mifflin (Curate) on Jun 10, 2005 at 04:55 UTC | |
by awohld (Hermit) on Jun 10, 2005 at 05:42 UTC | |
by spurperl (Priest) on Jun 10, 2005 at 05:52 UTC | |
by awohld (Hermit) on Jun 10, 2005 at 06:11 UTC | |
by spurperl (Priest) on Jun 10, 2005 at 06:25 UTC | |
by holli (Abbot) on Jun 10, 2005 at 07:22 UTC |