Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Filling a matrix

by Random_Walk (Prior)
on Aug 08, 2014 at 15:17 UTC ( [id://1096770]=note: print w/replies, xml ) Need Help??


in reply to Filling a matrix

I think Google chart may want JSON formatted data, so do have a look at the Perl JSON module. Its simple and fast. Otherwise you will be re-inventing wheels. Before that of course, you will need your data in something like the correct format. I guess you need an array of arrays...

# untested code use strict; use warnings; use Data::Dumper; use JSON; # read up on this, it may be a great help my $json = JSON->new->allow_nonref; my %elohimHash; # Not sure where this comes from, but obviously it mus +t be defined by here... my @ValsArray; for my $folderId (keys %elohimHash){ for my $customer (keys %{$elohimHash{$folderId}}){ for my $version (keys %{$elohimHash{$folderId}{$customer}}){ my $totSP = $elohimHash{$folderId}{$customer}{$version}{totSP +}; push @valsArray, [$version,$totSP]; } } } print Dumper \@ValsArray; print "-" x 30; print "\n"; print $json->encode(\@ValsArray);

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!

Replies are listed 'Best First'.
Re^2: Filling a matrix
by Laurent_R (Canon) on Aug 08, 2014 at 17:54 UTC
    my %elohimHash; # Not sure where this comes from, but obviously it mus +t be defined by here...
    Probably not. It appears that the hash has been populated before, since it is being read in order to populate the @valsArray array of arrays.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1096770]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-19 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found