I am querying an appliance and the response received is an array of hash references. I can read these just fine. Where I am having all my trouble is when I try to add fuctionality to allow me to query multiple (let's just start with 2) boxes at 1 time. I have tried setting up an array where each index is the array of hrefs and I've tried setting up an array with array references. What I have below is my latest attempt before asking for help. A better and shorter way to restate my question, and what I am having difficulty understanding from documentation is how I can take the list returned by the sub and put it a reference to it into the array @hostresults into index 0. Thank you, Frank
#!/usr/bin/perl use strict; use warnings; use SOAP::Lite; my @Data = @ARGV; # process box info my %host1 = ('ip'=>$Data[1],'user'=>$Data[2],'password'=>$Data[3],'ver +sion'=>$Data[4]); my %host2 = ('ip'=>$Data[5],'user'=>$Data[6],'password'=>$Data[7],'ver +sion'=>$Data[8]); my (@results,@results1,@results2); my (%hresults1,%hresults2); my @hostdata = (\%host1,\%host2); my @hostresults ; my ($ip,$user,$password,$version); for (my $i=0;$i<=1;$i++){ $ip = ${hostdata[$i]}{ip}; $user = ${hostdata[$i]}{user}; $password = ${hostdata[$i]}{password}; $version = ${hostdata[$i]}{version}; if ($version eq "ggg"){ @results = &get_list(); $hostresults[0] = &get_list(); print "RESULTS = @results\n"; print "--------------------\n"; print "HOSTRESULTS = ${$hostresults[0]}\n"; # <<< LIne 28
scratch.pl vstestlist.txt 172.24.17.41 admin adminggg 172.24.23.32 adm +in admin ddd RESULTS = GlobalLB::VirtualServerDefinition=HASH(0x3d7b504) GlobalLB:: +VirtualSer verDefinition=HASH(0x3d7afb4) GlobalLB::VirtualServerDefinition=HASH(0 +x3d793f4) GlobalLB::VirtualServerDefinition=HASH(0x3d79414) GlobalLB::VirtualSer +verDefinit ion=HASH(0x3d78f94) GlobalLB::VirtualServerDefinition=HASH(0x3d78d3c) +GlobalLB:: VirtualServerDefinition=HASH(0x3d78acc) GlobalLB::VirtualServerDefinit +ion=HASH(0 x3d788dc) GlobalLB::VirtualServerDefinition=HASH(0x3d786ac) GlobalLB:: +VirtualSer verDefinition=HASH(0x3d7847c) GlobalLB::VirtualServerDefinition=HASH(0 +x3d7820c) GlobalLB::VirtualServerDefinition=HASH(0x3d7801c) GlobalLB::VirtualSer +verDefinit ion=HASH(0x3d77dc4) GlobalLB::VirtualServerDefinition=HASH(0x3d77b94) -------------------- Can't use string ("14") as a SCALAR ref while "strict refs" in use at +scratch.pl line 28.

In reply to using / accessing nested hash/array references by tspfwj

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.