st4k has asked for the wisdom of the Perl Monks concerning the following question:
and basically I am having trouble forcing the incident into an array so I can call it like this:$VAR1 = { 'incident-report' => [ { 'incident' => { 'GDOT-INC-260089' => { 'location' => { 'link' => { 'direction' => 'South', 'hwy' => '2', 'content' => 'Southbound I-75 at DELK ROAD', 'name' => 'I-75', 'id' => '2078', 'mile-post' => '261.66' }, 'coord' => { 'y' => '435177', 'unit' => 'meters', 'x' => '670359', 'datum' => 'NAD83', 'projection' => 'GA State Plane West' }, 'county' => { 'content' => 'Cobb', 'id' => '67' }, 'type' => { 'content' => 'Freeway', 'id' => '1' }, 'description' => 'Southbound I-75 at Delk Road' }, 'status' => 'active', 'description' => 'Medium impact, 1 tractor-trailer, Cobb Co.', 'lanes' => '2 Right Lanes', 'level' => '3', 'type' => { 'content' => 'Accident', 'id' => '1' }, 'cleanup' => { 'timestamp' => '2003-06-19 17:20:00 EDT', 'content' => ' 5:20 PM Today' }, 'impact' => { 'content' => 'Medium', 'id' => '2' } },
It gives me the error about not being a valid array. Can anyone suggest something that might work to get that 'GDOT-INC-260089' part into an array so that I can loop through them? I want to share the code for this when I get it finished. Maybe someone in Georgia will be able to use it ;-)print $ref->{incident}->[0]->{location}->{county}->{content} . "\n";
2003-06-21 edit ybiC: two-space indents, quasi-vertical alignment of comma-arrows for legibility
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Simple parsing :-(
by chip (Curate) on Jun 19, 2003 at 21:33 UTC | |
by bobn (Chaplain) on Jun 20, 2003 at 03:12 UTC | |
by mirod (Canon) on Jun 20, 2003 at 16:29 UTC | |
|
Re: XML::Simple parsing :-(
by st4k (Novice) on Jun 19, 2003 at 21:40 UTC | |
by graff (Chancellor) on Jun 20, 2003 at 03:12 UTC | |
by st4k (Novice) on Jun 19, 2003 at 21:45 UTC | |
by chip (Curate) on Jun 19, 2003 at 22:28 UTC | |
by st4k (Novice) on Jun 20, 2003 at 00:12 UTC | |
by bobn (Chaplain) on Jun 20, 2003 at 03:01 UTC |