Perl 我该怎么处理这个错误;不是散列引用;?

Perl 我该怎么处理这个错误;不是散列引用;?,perl,cpan,strawberry-perl,Perl,Cpan,Strawberry Perl,我正在尝试执行用户创建的Perl脚本 usage: my.pl <type> <stats> [-map <map>] <session1> [session2] Produces statistics about the session from a Wireshark .pcap file where: <type> is the type of data in the pcap file (wlan, ethernet or i

我正在尝试执行用户创建的Perl脚本

usage: my.pl <type> <stats> [-map <map>] <session1> [session2] 
Produces statistics about the session from a Wireshark .pcap file where:
<type> is the type of data in the pcap file (wlan, ethernet or ip)
<stats> is the output file to write notable information
<session> is the pcap input file or a folder containing pcaps (recursive)
这是调试控制台-

    Not a HASH reference at folder/httpTrace.pm line 654. at folder/httpTrace.pm line 654
        folder::httpTrace.pm::readHttp('HASH(0x2306d38)', undef) called at my.pl line 56
        main::__processSession('google.pcap') called at my.pl line 35 Debugged program terminated.  
httpTrace.pm:最后一行

在my.pl as中还有map.pm和用法

    my $map;
    if( $ARGV[0] eq '-map' ) {
        shift( @ARGV );
        $map = Pcapstats::Map->new( shift( @ARGV ) );
    }

在您的文件
httpTrace.pm
中有这一行

foreach my $connect ( sort { $pa->{'id'} <=> $pb->{'id'} } values( %{ $conntable } ) ) {
foreach my$connect(排序{$pa->{'id'}$pb->{'id'}}值(%{$conntable})){
我想知道
$pa
$pb
是什么?除非您在其他地方设置了它们,否则它们将是未定义的,并且会让您使用未初始化的值错误。无论哪种方式,您都不会进行排序

但这并不能解释Not a HASH reference错误,这很可能是因为
$conntable
不是您认为的那样。如果未定义,则不会导致错误,因为AutoVivition将自动创建一个空哈希,因此它可能是一个简单的字符串或数字,或者可能是一个数组引用


如果您想显示设置
$conntable
的代码,我们可能会提供进一步帮助。

在您的文件
httpTrace.pm
中有这一行

foreach my $connect ( sort { $pa->{'id'} <=> $pb->{'id'} } values( %{ $conntable } ) ) {
foreach my$connect(排序{$pa->{'id'}$pb->{'id'}}值(%{$conntable})){
我想知道
$pa
$pb
是什么?除非您在其他地方设置了它们,否则它们将是未定义的,并且会让您使用未初始化的值错误。无论哪种方式,您都不会进行排序

但这并不能解释Not a HASH reference错误,这很可能是因为
$conntable
不是您认为的那样。如果未定义,则不会导致错误,因为AutoVivition将自动创建一个空哈希,因此它可能是一个简单的字符串或数字,或者可能是一个数组引用


如果您想显示设置
$conntable
的代码,我们可能会提供进一步帮助。

这听起来不像是依赖性问题。请提供一个最小的、可运行的问题演示。投票支持关闭(1)除非(给出更多信息('fast'));投票支持关闭(1)##他需要一段时间才能想出一个合适的问题。然后他可以开始一个新的问题。@P:已经结束。你可以开始一个新问题,不必着急。阅读并遵循。@jm666你能重新打开这个问题吗?我已经修改了它。这听起来不像是依赖性问题。请提供一个最小的、可运行的专业演示问题:投票赞成(1)除非(给出更多信息(“fast”);投票反对(1)##他需要一段时间才能想出一个合适的问题。然后他可以开始一个新的问题。@P:已经结束。你可以开始一个新问题,不必着急。阅读并跟随。@jm666你能重新打开这个问题吗?我已经修改过了。你能帮我吗?但我无法找到。如果需要,我可以提供更多细节。你能帮我吗e out?但我无法找到。如果需要,我可以提供更多详细信息。
    my $map;
    if( $ARGV[0] eq '-map' ) {
        shift( @ARGV );
        $map = Pcapstats::Map->new( shift( @ARGV ) );
    }
foreach my $connect ( sort { $pa->{'id'} <=> $pb->{'id'} } values( %{ $conntable } ) ) {