Re: foreach in my
- From: Joe Smith <joe@xxxxxxxxx>
- Date: Thu, 19 May 2005 02:29:09 -0700
thecento@xxxxxxxxx wrote:
The part that is throwing an error is:
foreach my $record (@$a_records) {
print " {
'content' => $record->{host},
'name' => $record->{name},
'type' => 'A'
},\n";
};
If you copy-and-paste that to a separate script, it compiles OK. This, however, fails with a syntax error near "foreach ":
[
foreach my $record (@ARGV) {print "$record\n";}
]Try
$r=$req->{attributes}{create_items}[0]{product_data}{zone}{records};
push @$r,{content=>$_->{host},name=$_->{name},type=>'A'} foreach @$a_records;
to populate the 'records' array after creating the structure.
Or, pre-calculate a temporary array and use a reference to that array when building the structure. -Joe .
- Follow-Ups:
- Re: foreach in my
- From: Cento
- Re: foreach in my
- From: Anno Siegel
- Re: foreach in my
- References:
- foreach in my
- From: thecento
- foreach in my
- Prev by Date: Re: getting IP address of remote host from socket (stdin)
- Next by Date: Re: no such file or directory?
- Previous by thread: Re: foreach in my
- Next by thread: Re: foreach in my
- Index(es):