相关疑难解决方法(0)

哈希键编码:为什么我要使用Devel :: Peek :: Dump两个不同的结果?

为什么我要带Devel :: Peek :: Dump两个不同的结果?

#!/usr/bin/env perl
use warnings;
use 5.014;
use utf8;
binmode STDOUT, ':encoding(utf-8)';
use Devel::Peek;

my %hash1 = ( 'müller' => 1 );
say Dump $_ for keys %hash1;

my %hash2;
$hash2{'müller'} = 1;
say Dump $_ for keys %hash2;
Run Code Online (Sandbox Code Playgroud)

输出:

SV = PV(0x753270) at 0x76d230
  REFCNT = 2
  FLAGS = (POK,pPOK,UTF8)
  PV = 0x759750 "m\303\274ller"\0 [UTF8 "m\x{fc}ller"]
  CUR = 7
  LEN = 8

SV = PV(0x753270) at 0x7d75a8
  REFCNT = 2
  FLAGS = (POK,FAKE,READONLY,pPOK)
  PV = …
Run Code Online (Sandbox Code Playgroud)

perl hash encoding key

12
推荐指数
1
解决办法
1039
查看次数

标签 统计

encoding ×1

hash ×1

key ×1

perl ×1