$echo '{"a"=>1,"b"=>2}' > val.pl $perl -le 'my $foo = do "val.pl"; print $foo->{a}' 1
更好的答案:考虑使用更好的数据序列化格式,例如Storable或YAML,甚至是JSON.