in reply to Constructing HoHoA from AoA

neversaint,
The following code does what you want
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @nar = ( ['fact 1 - ParamGrp1', 'foo', 'bar'], ['fact 1 - ParamGrp2', 'qux', 'bom'], ['fact 1 - ParamGrp1', 'fuu', 'gong'], ['fact 2 - ParamGrp1', 'fiu', 'ging'], ); my %data; for my $elem ( @nar ) { my ($key, @val) = @$elem; my ($key_1, $key_2) = split " - ", $key; push @{ $data{$key_1}{$key_2} }, [ @val ]; } print Dumper(\%data);
It has been over 3 weeks since I have written a single line of code so please forgive me for posting a working solution without really answering the question being asked.

Cheers - L~R

Replies are listed 'Best First'.
Re^2: Constructing HoHoA from AoA
by qbxk (Friar) on Jan 02, 2006 at 17:23 UTC
    Limbic~Region nailed it, I took your hash and your desired hash, wrote my own little loop and lo and behold, i got the same code. (hey that rhymed!)

    so since it's the same no need to post it...


    It's not what you look like, when you're doin' what you’re doin'.
    It's what you’re doin' when you’re doin' what you look like you’re doin'!
         - Charles Wright & the Watts 103rd Street Rhythm Band