arrays - 如何将 perl assc 数组指向简单数组并推送新值?
问题描述
这是概念:
%aa = (
'allphotos' => {}
);
$newkey = 'photogroupone';
$newphotoone = 'dogs at play';
$newphototwo = 'cats at play';
push $aa{'allphotos'}{$newkey}, $newphotoone;
push $aa{'allphotos'}{$newkey}, $newphototwo;
Perl 5.24
他们希望发布更多文字。有什么好说的。
解决方案
关。第一个参数必须是一个数组。
push @{ $aa{'allphotos'}{$newkey} }, $newphotoone;
push @{ $aa{'allphotos'}{$newkey} }, $newphototwo;
要不就
push @{ $aa{'allphotos'}{$newkey} }, $newphotoone, $newphototwo;
推荐阅读
- python - Numpy python R等效索引
- sql-server - SQL Server、ADO 锁记录
- python - 在 python 中的字符串格式化期间,不是所有的参数都被转换
- dataframe - if 语句:如果数据点的数量小于 x 则返回 NaN 否则计算数据帧的年化回报
- javascript - 流类型:可扩展的 React 组件道具类型
- python - 即使在从 python 脚本在 linux 中执行脚本之后也永久设置环境变量
- apache-spark - 如何在 Spark Streaming 应用程序中对通过 Kafka 发送的 Hive 表执行查询?
- python - 无法在 python 中使用 pywinauto 自动单击“Oracle VM 虚拟框”按钮
- node.js - 如何在 Sequelize 中忽略 SequelizeUniqueConstraintError?
- python - 沿特定列对 ndarray 进行排序