我试图从to 3.11上的MO调用中删除msisdn字段,但它不处理所需的内容。
我想设置一个条件,如果Msisdn没有从962开始,那么删除元素。
我的背景仅限于python,这是第一次使用perl。我使用它是因为在搜索之后,我相信只有perl才能处理TAP文件。
# Will scan all the calls for MTC's.
foreach $key ( @{$struct->{'transferBatch'}->{'callEventDetails'} } ) {
foreach ( keys %{$key} ) {
if ( $_ eq "mobileOriginatedCall" )
{
if ( defined $key->{$_}->{'basicCallInformation'} )
{
if ( defined $key->{$_}->{'basicCallInformation'}->{'chargeableSubscriber'} )
{
if ( defined $key->{$_}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'})
{
if ( defined $key->{$_}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'}->{'msisdn'})
{
if ($key->{$_}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'}->{'msisdn'} =~ /^[962]/)
{
$key->{$_}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'}->{'msisdn'}=();
}
}
}
}
}
}
}
}发布于 2019-05-15 12:06:42
试着:
...
if ($key->{$_}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'}->{'msisdn'} =~ /^(?!962)/)
{
delete $key->{$_}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'}->{'msisdn'};
}更改::
要删除密钥,请使用删除
对于"not starting with“regex,请使用:^(?!WHATEVER),例如^(?!962)
https://stackoverflow.com/questions/56148404
复制相似问题