Hash Fold:Perl模块用于展平和展平嵌套的哈希引用 源码
哈希::折叠 名称 Hash :: Fold-展平和展平嵌套的hashrefs 概要 use Hash::Fold qw( flatten unflatten ) ; my $object = bless { foo => ' bar ' }; my $nested = { foo => $object , baz => { a => ' b ' , c => [ ' d ' , { e => ' f ' }, 42 ], }, }; my $flattened = flatten( $nested ); is_deeply $flattened , { ' baz.a ' => ' b ' , ' baz.c.0 ' => ' d ' , ' baz.c.1.e ' => ' f ' ,
用户评论