我不是Perl专家,所以这可能是一个简单的问题。
我一直在使用Storable,并遵循this example来存储散列。首先,我存储原始散列。
use Storable qw(store retrieve freeze thaw dclone);
%color = ('Blue' => 1, 'Red' => 0.8, 'Black' => 0, 'White' => 1);
store(\%color, 'mycolors');然后我找回它。(不同的脚本)
use Storable qw(store retrieve freeze thaw dclone);
$colref = retrieve('mycolors');
printf "Blue is still %lf\n", $colref->{'Blue'};我的问题是如何更改其中一个散列值?例如,执行如下操作
$colref->{'Blue'} = 2;
store(\%color, 'mycolors');在第二个脚本中。
发布于 2012-04-16 03:26:30
需要改变
store(\%color, 'mycolors');至
store($colref, 'mycolors');https://stackoverflow.com/questions/10165174
复制相似问题