检索 Data::Dumper 元素
我正在使用 Data::Dumper 通过 SOAP 消息传递从服务器检索信息,并且需要一些帮助来分配返回值以进行处理。我的代码是:
my $cm = new SOAP::Lite
encodingStyle => '',
uri => "$axltoolkit",
proxy => "https://$cucmip:$axl_port/axl/";
my $res =$cm->getUser(SOAP::Data->name('userid' => "387653"));
unless ($res->fault) {
$Data::Dumper::Incident=3;
my( $reply ) = $res->paramsall();
my ($devices) = $reply->{user}{associatedDevices}{device};
print $devices->[0]."\n";
print $devices->[1]."\n";
print $devices->[2]."\n";
{device} 可以包含任意数量的元素,因此不必调用 $devices->[0]、[1] 等 - 是否可以吐出所有返回的设备?我尝试过 $_ 和 @_ 但没有运气,因为它只返回第一个设备。
任何帮助表示赞赏。
谢谢
I'm using Data::Dumper to retrieve information from a server with SOAP messaging and need some assistance with assigning the return values for processing. My code is:
my $cm = new SOAP::Lite
encodingStyle => '',
uri => "$axltoolkit",
proxy => "https://$cucmip:$axl_port/axl/";
my $res =$cm->getUser(SOAP::Data->name('userid' => "387653"));
unless ($res->fault) {
$Data::Dumper::Incident=3;
my( $reply ) = $res->paramsall();
my ($devices) = $reply->{user}{associatedDevices}{device};
print $devices->[0]."\n";
print $devices->[1]."\n";
print $devices->[2]."\n";
{device} could contain any number of elements so instead of calling out $devices->[0],[1],etc - is it possible to spit out all of the returned devices? I've tried $_ and @_ but no luck since it just returns the first of the devices.
Any help is appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的意思是
?
或者更简洁一点
You mean
?
Or more concisely