Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl 使用“严格”和“警告”获取列表时出错_Perl - Fatal编程技术网

Perl 使用“严格”和“警告”获取列表时出错

Perl 使用“严格”和“警告”获取列表时出错,perl,Perl,运行在同一目录中的文件列表上运行的Perl脚本可以创建更改列表,并且对我来说效果很好,但目前,我必须在sun Solaris 10上使用该脚本,但我收到以下警告: 在/usr/perl5/5.8.4/lib/sun4-solaris-64int/Convert/ASN1//u decode.pm第58行使用未初始化的长度值 在串联中使用未初始化的值。或位于/usr/perl5/5.8.4/lib/sun4-solaris-64int/Convert/ASN1//u encode.pm第60行的字

运行在同一目录中的文件列表上运行的Perl脚本可以创建更改列表,并且对我来说效果很好,但目前,我必须在sun Solaris 10上使用该脚本,但我收到以下警告:

在/usr/perl5/5.8.4/lib/sun4-solaris-64int/Convert/ASN1//u decode.pm第58行使用未初始化的长度值

在串联中使用未初始化的值。或位于/usr/perl5/5.8.4/lib/sun4-solaris-64int/Convert/ASN1//u encode.pm第60行的字符串

在搜索之后,我发现了一些东西,比如使用严格和使用警告,但当我进行更改时,它返回以下错误:

全局符号@files需要在./5th_edit.pl处显示包名

第14行。全局符号@dirs要求在 /5th_edit.pl第15行

用my而不是local初始化@files和@dirs变量


我以前做过,但还是一样的问题,我只有更换local@files; local@dirs; 用我的@文件;还有我的@dirs;严格和警告的概念就是,它告诉你你的问题在哪里,以及具体的界线是什么。。。因此,添加我的@文件;还有我的@Dirs;刚刚用完的数据::转储程序;要声明它们并在这一行中为每个my$file@files添加my before$file{谢谢,亲爱的,仍然是一样的,但现在我可以看到问题的确切位置,它返回参数mobileOriginatedCall在/5th_edit.pl第72行的数组元素中不是数字。这不是完全相同的问题。这意味着您的数组存在问题。
#!/usr/bin/perl -w

use strict;
use warnings;

use TAP3::Tap3edit;
use Data::Dumper;



printDir(".");
sub printDir{
opendir(DIR, $_[0]);
local(@files);
local(@dirs);
 (@files) = readdir(DIR);
 foreach $file (@files) {
    if (-f $file and substr($file,0,2) eq "CD" ) {


     my $tap3 = TAP3::Tap3edit->new;

     my $tap_file = $file;
$tap3->decode($tap_file)  or  die $tap3->error; 

my $struct=$tap3->structure;
my $Tracker = $struct->{'transferBatch'};
if (defined $Tracker){

    my $rectag = $struct->{'transferBatch'}->{'networkInfo'}->{'recEntityInfo'};

    map { $_->{'recEntityType'} = 4 if ( $_->{'recEntityType'} > 6) } @$rectag;

    my $calleventtag = $struct->{'transferBatch'}->{'callEventDetails'};

    my @indexes = reverse (grep { exists $calleventtag->[$_]->{'supplServiceEvent'} } 0..$#$calleventtag);

    my $sup_event_cnt = $#indexes;

    foreach my $index (@indexes)
    {
    splice (@$calleventtag , $index,1);
    }

    my $total_events_cnt = $struct->{'transferBatch'}->{'auditControlInfo'}->{'callEventDetailsCount'};
    $struct->{'transferBatch'}->{'auditControlInfo'}->{'callEventDetailsCount'} = $total_events_cnt - $sup_event_cnt-1;

    if ( exists $struct->{'transferBatch'}->{'batchControlInfo'}->{'operatorSpecInformation'} )
        {
            delete $struct->{'transferBatch'}->{'batchControlInfo'}->{'operatorSpecInformation'};
        }
    if ( exists $struct->{'transferBatch'}->{'auditControlInfo'}->{'operatorSpecInformation'} )
        {
            delete $struct->{'transferBatch'}->{'auditControlInfo'}->{'operatorSpecInformation'};
        }

my $key;

# Will scan all the calls for MOC's and GPRS.
foreach $key ( @{$struct->{'transferBatch'}->{'callEventDetails'} } ) {

    foreach ( keys %{$key} ) {

        if ( $_ eq "mobileOriginatedCall" )
        {

            if ( exists $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'destinationNetwork'} )
            {
                delete $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'destinationNetwork'};
            }

            if ( exists $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'}->{'msisdn'} 
            && $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'}->{'msisdn'} !~ m/^1299/ 
            )
            {
                delete $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'}->{'msisdn'};
            }

            if ( exists $calleventtag->[$_]->{'mobileOriginatedCall'}->{'camelServiceUsed'}  
            && $calleventtag->[$_]->{'mobileOriginatedCall'}->{'camelServiceUsed'}->{'camelServiceKey'} != 80
            )
            {
                delete $calleventtag->[$_]->{'mobileOriginatedCall'}->{'camelServiceUsed'};
            }

        }

        if ( $_ eq "gprsCall" )
        {

            if ( exists $calleventtag->[$_]->{'gprsCall'}->{'gprsBasicCallInformation'}->{'gprsDestination'}->{'accessPointNameOI'} )
            {
                delete $calleventtag->[$_]->{'gprsCall'}->{'gprsBasicCallInformation'}->{'gprsDestination'}->{'accessPointNameOI'};
            }

        }

    }
}


    $tap3->encode("$tap_file")  or  die $tap3->error; 
}    

    }

 } 

 closedir(DIR);
}
my @files;
my @dirs;