I am now trying to use RPC::XML, and I now get results. When I use Data::Dumper it looks like the output below. I have tried several different things but cannot get the values out (like 333333333333333, heyheywearethemonkeys (from 'thiskey'), and item1 from the 'thattoo' array. I have searched and searched but all of the examples I have seen give me an error, like "can't coerce array into hash".
... my $req = RPC::XML::request->new('search', @paramfields); my $resp = $client->send_request($req); print "Response is $resp\n"; print Dumper(\$resp); ### NOW I WANT TO GET SOME VALUES OUT ### but I can't figure it out! ### am I missing some critical documentation? ### I tried to read on CPAN but that didn't help or make sense to me
Here is what Data::Dumper shows:
Response is RPC::XML::array=ARRAY(0x8465fb0) $VAR1 = \bless( [ bless( do{\(my $o = '333333333333333')}, 'RPC::XML::int' ), bless( do{\(my $o = '0.158333')}, 'RPC::XML::double' ), bless( [ bless( { '' => bless( do{\(my $o = '')}, 'RPC::XML::string' ), 'thiskey' => bless( do{\(my $o = 'heyheywearethemonkeys')} +, 'RPC::XML::string' ), 'that' => bless( do{\(my $o = '6')}, 'RPC::XML::int' ), 'thistoo' => bless( do{\(my $o = 'Joe')}, 'RPC::XML::strin +g' ), 'thattoo' => bless( [ bless( do{\(my $o = 'item1')}, 'RPC::XML::string' ), bless( do{\(my $o = 'item2')}, 'RPC::XML::string' ), bless( do{\(my $o = 'item3')}, 'RPC::XML::string' ) ], 'RPC::XML::array' ), 'something' => bless( do{\(my $o = '')}, 'RPC::XML::string +' ), 'somethingelse' => bless( do{\(my $o = 'EFG')}, 'RPC::XML: +:string' ), 'hello' => bless( do{\(my $o = '2003')}, 'RPC::XML::int' ) }, 'RPC::XML::struct' ), bless( { '' => bless( do{\(my $o = '')}, 'RPC::XML::string' ), 'hola' => bless( do{\(my $o = '2940')}, 'RPC::XML::string' + ), 'howdy' => bless( do{\(my $o = '6')}, 'RPC::XML::int' ), 'doody' => bless( do{\(my $o = 'Smithton')}, 'RPC::XML::st +ring' ), 'a_list' => bless( [ bless( do{\(my $o = 'getitem1')}, 'RPC::XML::string' ) +, bless( do{\(my $o = 'getitem2')}, 'RPC::XML::string' ) +, bless( do{\(my $o = 'getitem3')}, 'RPC::XML::string' ) ], 'RPC::XML::array' ), 'hi' => bless( do{\(my $o = '')}, 'RPC::XML::string' ), 'yo' => bless( do{\(my $o = 'HIJ')}, 'RPC::XML::string' ), 'ciao' => bless( do{\(my $o = '1951')}, 'RPC::XML::int' ) }, 'RPC::XML::struct' ), ], 'RPC::XML::array' ) ], 'RPC::XML::array' );

OKAY...UPDATE...
I tried something else and now I get this structure from Data::Dumper. It is a ton easier to read, but when I try to get the values out it tells me "Global symbol "@result" requires explicit package name". I was trying:
print $result[0] or $result[4]{'thiskey'}, "\n";
Update again
Okay I did this:
my @newresult = $result; print $newresult[0][0], "\n";
and that gave me the 'this' value. Now I just need to figure how to get values out of the hash.
and this is the data:
$VAR1 = \[ 'this', 'that', 'hmmm', 'ok', [ { '' => '', 'somelist' => [ 'item1', 'item2', 'item3' ], 'thiskey' => 'nomoremonkeysjumpingonthebed', 'hiii' => '0.200000', }, { '' => '', 'somelist' => [ 'item1', 'item2', 'item3' ], 'thiskey' => 'nomoremonkeysjumpingonthebed', 'hiii' => '0.200000', }, ] ];
Any help would be much appreciated! THANKS!

In reply to getting values out of RPC::XML response array by inblosam

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.