小编idi*_*erl的帖子

将具有相同键的哈希值转换为Perl中的数组哈希值

我需要将哈希转换为perl中的数组哈希

我有:

%hash = (
    tinku => 15,
    tina  => 4,
    rita  => 18,
    tinku => 18,
    tinku => 17,
    tinku => 16,
    rita  => 19
);
Run Code Online (Sandbox Code Playgroud)

我想将其更改为:

%hash =  ( tinku => [ 15, 16, 17, 18 ], rita => [ 18, 19 ], tina => 4 );
Run Code Online (Sandbox Code Playgroud)

perl associative-array hashtable data-structures perl-data-structures

1
推荐指数
2
解决办法
1176
查看次数