I have tried, I have searched in the internet and I am out of ideas at this moment. I have an array which has elements. I use to Dumper function to ensure that the elements are present however, when I try to access individual items, I don't get the expected output.
And someone please help.
This is the code
print "<pre>Array: ".Dumper(@configFiles)."\n";
print "First: ".$configFiles[0]."\n";
print "Second: ".$configFiles[1]."</pre>";
Below is the output
Array: $VAR1 = [
'searchTables.json',
'NAM_database.json'
];
First: ARRAY(0x9a8f60)
Second:
In case you are wondering how were the array elements assigned, I read a json file then converted it with the function below.
sub parseJson{
my ($jfilename) = @_;
if(-e "$jsoncPath/$jfilename"){
return decode_json($json_data);
}else{
}
}
See the json below
[
"searchTables.json",
"NAM_database.json"
]
I also tried de-referencing as seen below with no success
print "<pre>First: ".@{$configFiles[0]}."</pre>";
give me what is sceen below.
First: 2
Dumper(\@configFiles).