vCard的文档显示它想要:
addresses()
Accepts/returns an arrayref that looks like:
[
{ type => ['work'], street => 'Main St', preferred => 0 },
{ type => ['home'],
pobox => 1234,
extended => 'asdf',
street => 'Army St',
city => 'Desert Base',
region => '',
post_code => '',
country => 'USA',
preferred => 1,
},
]
我必须从CSV文件生成此调用。我可以提取数据,但无法弄清楚如何将其传递给$vcard->addresses
。
这失败了:
if (keys %addrwork > 0 )
{
$addrwork{'type'} = ['work'];
push @arraytmp, %addrwork;
}
# did we get any part of a home or work address?
if ( $#arraytmp >= 0 ) {
$vcard->addresses( @arraytmp );
失败:
Can't use string ("type") as an ARRAY ref while "strict refs" in use at /usr/local/share/perl/5.22.1/vCard.pm line 254, <FILE> line 2.
答案 0 :(得分:4)
接受/返回如下所示的 arrayref :
您传递的是数组,而不是数组引用。解决它:
TreeView