#!/usr/bin/env perl use strict; use warnings; my $VAR1 = ... your posted data here ...; my @records = @$VAR1; for my $index (0 .. $#{$records[0]}) { print "$records[0][$index][1] -> $records[0][$index][0]\n"; }
Output:
Science | -> Sciences | Research | -> Recherche | Artificial Intelligence -> Intelligence artificielle
So, that gets the job done. With a better understanding of the data you start with, I expect that could probably be greatly simplified.
Using the same name (i.e. decoded_json) for both a scalar and an array variable has a high chance of tripping you up somewhere in the code. You show Dumper $record in your posted code but later you say "Dump was of \@records".
I'm also getting the sense that you're not overly familiar with handling arrays and arrayrefs. Take a look at perlintro; its "Perl variable types" section; the "Arrays" subsection; then follow the "Exhaustive information ..." links at the end (i.e. right before the "Variable scoping" heading).
— Ken
In reply to Re: Parsing Array of arrays from json file
by kcott
in thread Parsing Array of arrays from json file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |