不使用while循环将是最优选的(例如,one-liner将是最好的)。
use Data::Dumper; my %hash = ('abc' => 123,'def' => [4,5,6]); print Dumper(\%hash);
将输出
$VAR1 = { 'def' => [ 4,6 ],'abc' => 123 };