Hi :D

After days of messing around with perl mods, trying to get them to work...

It is easier/more important to resolve this issue of installing mods, monk, see Tutorials:A Guide To Installing Modules, installing modules non-interactively, in your home directory

I gave up and am trying to code it myself as it seems simple enough to parse this EXAMPLE DATA

Thats not valid xml, friend /*Mwahaha*

(XML:Simple simply won't work on my host and I don't have access to add other mods) ...

Sir, Yes, even you can use CPAN

I'm looking to create this example from LUA, unless theres an easier way to do this of course

And we should know lua syntax? Boy howdy

Well, it looks close enough to this format, so you can use one of those solutions :D

I'm trying to build an array from the table data above by reading line by line and creating the appropriate array tree

Ok dawg, here you go, magic, Data::Lua - Parse variables out of Lua code.

update: Sorry cat, too much magic, its kinda hard to install, needs Inline::Lua

I'm sure its easy for you all, but not me Thank-you *bow*

Yeah, copy/paste can be easier if you can grok how to use it, see Re^2: parsing XML fragments (xml log files) with... a regex

XML::Simple is easier

#!/usr/bin/perl -- use strict; use warnings; use Data::Dumper; use XML::Simple; my $lua =<<'__LUA__'; <GeocodeResponse> <status>OK</status> <result> <type>street_address</type> <formatted_address>1600 Amphitheatre Pkwy</formatted_address> <address_component> <long_name>1600</long_name> <short_name>1600</short_name> <type>street_number</type> </address_component> </result> </GeocodeResponse> __LUA__ print Dumper( XMLin($lua, ) ), "\n\n"; __END__ $VAR1 = { 'status' => 'OK', 'result' => { 'formatted_address' => '1600 Amphitheatre Pkwy +', 'type' => 'street_address', 'address_component' => { 'short_name' => '1600 +', 'long_name' => '1600' +, 'type' => 'street_num +ber' } } };

Don't feel jealous :D

I'm a horsey with the bran of a turtlecat, dawg

In reply to Re: recreating an array by Anonymous Monk
in thread recreating an array by Inexistence

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.