user3595231
user3595231

Reputation: 767

How to get the 2-D Array data in perl script?

We have a client code which is written in perl, and it is trying to connect to a WebService to make an API call.

  1. This API call is written in java, and it returns a 2-Dimemsion String Array.
  2. Here is the code on Client side:

    eval {
            $service = SOAP::Lite->service("some WS link here");
    };
    if ($exception = $@) {
            print("Failed to connect to WS: $exception");
            return 0;
    }

    my $status;
    eval {
            $status = $service->getStatus();
    };
    if ($exception = $@) {
            print("$exception");
            return 0;
    }

My question is how to extract the actual data from this "$status" value. When I was to print this "$status" value, I can only see this:


     DB> p $status
     stringArrayArray=HASH(0x126e2ac0)
     DB>

Upvotes: 0

Views: 55

Answers (1)

Sobrique
Sobrique

Reputation: 53478

That means your modules has returned a hash reference. You can see what's in it with e.g. Data::Dumper

Or:

foreach my $key ( keys %$status ) { 
   print "$key => ", $status -> {$key}, "\n"; 
}

See: perlref

Upvotes: 1

Related Questions