in reply to Hash of Hashes of Arrays

Well, I noticed that in your %HoH, you're using a range operator for the array ref. Assuming your really do want a range and that the 3rd and 4th values are always in the correct order, you can do this:

#!/usr/local/bin/perl use strict; use warnings; use Data::Dumper; $Data::Dumper::Indent = 1; my @AoA = ( [qw/10 27 17 20/], [qw/10 24 22 25/], [qw/11 25 24 25/], [qw/11 26 19 20/], ); my %HoH; foreach my $aref (@AoA) { my ($key1, $key2) = splice @$aref => 0, 2; @$aref = $aref->[0] .. $aref->[1]; # this creates the range $HoH{$key1}{$key2} = $aref; } print Dumper \%HoH;

If the range operator was a typo, you can delete the line I marked with the comment. If the order of the 3rd and 4th elements are not guaranteed, then it's trivial to reverse 'em.

Of course, depending on your data, you may or may not want sanity checking in there.

Cheers,
Ovid

New address of my CGI Course.

Replies are listed 'Best First'.
Re^2: Hash of Hashes of Arrays
by Miguel (Friar) on Jan 11, 2005 at 01:57 UTC
    Thank you very much!

    The 3rd and 4th elements are always in the correct order. So no worries about that.