×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Reading array location

Reading array location

Reading array location

(OP)
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("https://myaddress.com/iControl/iControlPortal.cgi");
$peeraddress = $SystemInfo->get_list();
$peer = $peeraddress->result;

print $peer;
print "\n";

RE: Reading array location

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
www.studiosoft.co.uk

RE: Reading array location

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

Franco
http://www.xcalcs.com : Online engineering calculations
http://www.megamag.it : Magnetic brakes for fun rides
http://www.levitans.com : Air bearing pads

RE: Reading array location

(OP)
Thanks All,
Yeah I finally got it figured out by doing the dereference. Thanks

Wally

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close