小编Mel*_*ssa的帖子

Perl的Data :: Dumper显示对象而不是值

 foreach my $row (1..$end) 
 { 
  foreach my $col (3..27 ) 
  { 
    # skip empty cells 
    next unless defined 
    $worksheet->Cells($row,$col)->{'Value'}; 

    # print out the contents of a cell  
    $var = $worksheet->Cells($row,$col)->{'Value'};     
    push @dates, $var;  

    print $var; #this prints the value just fine
  } 
 }  

my %hash;
$hash{'first'} = \@dates;
print Dumper \%hash; #This prints object information 
Run Code Online (Sandbox Code Playgroud)

我使用模块OLE for Perl和我从工作表中获得的每个值并打印$ var然后我得到了预期的值,但是当我把所有内容放入哈希时它打印:

'first' => [
bless( do{\(my $o = 15375916)}, 'OLE::Variant'), 
bless( do{\(my $o = 15372208)}, 'OLE::Variant'),
Run Code Online (Sandbox Code Playgroud)

等等.我一定不明白哈希的事情,因为我真的很难过.

perl hash ole data-dumper

6
推荐指数
1
解决办法
1551
查看次数

标签 统计

data-dumper ×1

hash ×1

ole ×1

perl ×1