sub print_global_defs
{
my @FC_Names = @{ $conf_data->{'SW-SYSTEMS'}->{'SW-SYSTEM'}->{'CONF-SPEC'}->{'CONF-ITEMS'}->{'CONF-ITEM'} };
my $FC_Count = @FC_Names;
for(my $i = 0; $i < $FC_Count; $i++) {
print CFILE "&", @FC_Names['$i']->{'CONF-ITEMS'}->{'CONF-ITEM'}->{'CONF-ITEMS'}->{'CONF-ITEM'}->[0]->{VT}, "}\n";
}
}
The problem is that inside the 'for' loop, the variable $i in @FC_Names['$i] always gets evaluated to 0 and it always returns the same element (first one) from the XML file. Thus the c file gets printed out with the same element (the first one) repetatively instead of all the elements consecutively.
Can anyone tell me how to correctly reference the numeric variable 'i' inside the array FC_Names so that the correct value of i is used as an index insde the array such that the correct element of the XML file is referenced?
I would appreciate any help.
Thanks!