Hi, thanks for responding.
foreach my $r (keys %$result){ print $r->result->{Person}->{commonname}; }
gives Can't locate object method "result" via package "_content" (perhaps you forgot to load "_content"?) at ./searchPeople.pl
foreach my $r ($result->result){ print $r->{Person}->{commonname}; }
works for a unique item i.e. login id but gives the pseudo hash deprecated error and bad index error as above

foreach my $r (@$result){ print $r->result->{Person}->{commonname}; }
Gives 'not an ARRAY reference'.

This is output from data dumper when the search method is given 'shaw', ive truncated a load of other data and other people for demo purposes:

$VAR1 = { 'Person' => [ { 'commonname' => 'person 1', 'location' => 'location 1', 'telephonenumber' => '34567688', 'surname' => 'Shaw' }, { 'commonname' => 'person 2', 'location' => 'location 2', 'telephonenumber' => '1234576', 'surname' => 'Birkinshaw' }
Looking at this then, is Person an array and not a hash? How would i get at each element of the person array if it is?

The search method isnt part of the SOAP::Lite docs - its a web method from my webservice.

Thanks

Joe

UPDATE I can get at the second person using

print $result->result->{Person}[1]->{commonname};

Now all i need is a loop...thanks

-----

Eschew obfuscation, espouse eludication!


In reply to Re^4: SOAP::Lite and hash of hashes by joec_
in thread SOAP::Lite and hash of hashes by joec_

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.