Here is a similar example of what I am trying to do:
@name = qw (Sam Tom John Mike Andrea);
@scores = qw (92 80 59 83 88);
I need to store thes
Assuming you want to keep them as separate arrays, stick references to them in a hash first:
my %data = ( names => \@names, scores => \@scores );
Then use the JSON module to serialize the data structure to JSON, e.g.:
use strict;
use warnings;
use JSON;
my @names = qw (Sam Tom John Mike Andrea);
my @scores = qw (92 80 59 83 88);
my %data = ( names => \@names, scores => \@scores );
my $json = encode_json \%data;
print $json
Output:
{"names":["Sam","Tom","John","Mike","Andrea"],"scores":["92","80","59","83","88"]}