我需要使用Perl 提取关联rightmh =之后放置的字符串.
在此示例中:"0x42001dc"和"0x4200000".
每个字符串将添加到同一个数组中.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<association-response-list xmlns="http://url.com">
<association-responses>
<association rightmh="0x42001dc" leftmh="0x4055246" rh="0x1003b"/>
<association rightmh="0x4200000" leftmh="0x455246" rh="0x1003b"/>
</association-responses>
</association-response-list>
Run Code Online (Sandbox Code Playgroud) 我对 perl 中的 Given-When 语句很陌生。我想为 $var=0 或 2 获得相同的结果,有什么帮助吗?
我尝试了以下操作,但出现错误。
given($var) {
when(0 || 2) { print "bala";}
when(1) {print "blabla";}
default {print "default";}
}
Run Code Online (Sandbox Code Playgroud)