Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading array location

Status
Not open for further replies.

steady12345

Technical User
Jun 14, 2012
4
US
Greetings all,
I am working with a perl script and a module called IControl that gives me information about a Load Balancer

When I run my script and do a get_list() the value returned to $peer is ARRAY(0x2d7208c)

I don't know the next step for reading from that array location and was wondering if someone could guide me in the right direction

Code:
#!/usr/bin/perl
BEGIN { $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0 } 
use SOAP::Lite;
use iControlTypeCast;
use MIME::Base64;
use myAuth ();
use vars qw($sUID $sPWD);
*sUID = \$myAuth::sUID;
*sPWD = \$myAuth::sPWD;

print "BEGIN TEST\n";
sub SOAP::Transport::HTTP::Client::get_basic_credentials {
print "In SOAP\n";  
return "$sUID" => "$sPWD";
}
$SystemInfo  = SOAP::Lite
  -> uri('urn:iControl:LocalLB/Pool')
  -> proxy("[URL unfurl="true"]https://myaddress.com/iControl/iControlPortal.cgi");[/URL]
$peeraddress = $SystemInfo->get_list();
$peer = $peeraddress->result;

print $peer;
print "\n";
 
Just a guess here but as the fuinction is returning an array, try replacing
Code:
$peer = $peeraddress->result;
print $peer;

with

Code:
my @peer = $peeraddress->result;
print $peer[0];

and see what happens.

Keith
 
[tt]$peer[/tt] is a reference to an array. You should be able to dereference it as follows:
access to a single element: [tt]$$peer[index][/tt]
access to the whole array (and no.of elements): [tt]@$peer[/tt]
last index of the array: [tt]$#$peer[/tt]

Franco
: Online engineering calculations
: Magnetic brakes for fun rides
: Air bearing pads
 
Thanks All,
Yeah I finally got it figured out by doing the dereference. Thanks

Wally
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top